Skip to content

Latest commit

 

History

History
122 lines (90 loc) · 2.78 KB

File metadata and controls

122 lines (90 loc) · 2.78 KB

VisoLingua Desktop Shortcut Creation

🔧 Problem Fixed: PowerShell Escaping Error

The PowerShell escaping problem has been fixed! Here are all available methods:

🚀 Option 1: VBScript Version (Recommended)

# Most reliable method - works on all Windows versions
create_shortcut_fixed.bat

Advantages:

  • ✅ Works on Windows 7-11
  • ✅ No PowerShell execution policy issues
  • ✅ Robust error handling

🚀 Option 2: PowerShell Version (Modern)

# For modern Windows systems
powershell -ExecutionPolicy Bypass -File "Create-Shortcut.ps1"

Advantages:

  • ✅ Native PowerShell
  • ✅ Better error handling
  • ✅ Detailed output

🚀 Option 3: Repaired Batch Version

# Original batch file - now repaired
create_shortcut.bat

Change:

# Old (broken):
powershell -Command "$WshShell = ..."

# New (works):
powershell -Command "& {$WshShell = ...}"

📋 Available Shortcut Creators:

File Method Compatibility Recommendation
create_shortcut_fixed.bat VBScript Windows 7-11 Best
Create-Shortcut.ps1 PowerShell Windows 10+ ✅ Modern
create_shortcut.bat PowerShell Windows 10+ ✅ Repaired

🛠️ Troubleshooting:

"Execution Policy" Error (PowerShell):

# Run once:
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser

# Or bypass directly:
powershell -ExecutionPolicy Bypass -File "Create-Shortcut.ps1"

VBScript Blocked:

  • Add Windows Defender exception
  • Or create shortcut manually

Manual Shortcut Creation:

  1. Right-click on Desktop → "New" → "Shortcut"
  2. Enter path: C:\Path\to\VisoLingua.exe
  3. Name: "VisoLingua"
  4. Finish

🎯 Recommended Workflow:

For Developers:

# 1. Build EXE
python build_exe.py

# 2. Change to dist/ directory
cd dist

# 3. Create shortcut (best method)
..\create_shortcut_fixed.bat

For End Users (Portable Package):

# Create portable package (contains all shortcut creators)
create_portable.bat

# In package then:
cd VisoLingua-Portable
"Create Desktop Shortcut.bat"  # Uses VBScript method

🔧 What Was Fixed:

PowerShell Escaping:

# Problem: ^ character doesn't work in PowerShell
powershell -Command "...(^)..."  # ❌ Error

# Solution: Use & {} block
powershell -Command "& {...()...}"  # ✅ Works

Robustness:

  • VBScript fallback for maximum compatibility
  • Error handling in all versions
  • Path validation before shortcut creation
  • Cleanup of temporary files

💡 Recommendation:

For maximum compatibility: Use create_shortcut_fixed.bat For modern systems: Use Create-Shortcut.ps1

Both methods are now fully functional! 🎉