You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Full contents of requirements.txt (installed modules) - just for sanity check:
pyshortcuts==1.9.0
pywin32==306
=====main.py contents===============
import os
import sys
from pyshortcuts import make_shortcut
lnk_name = "My application.lnk"
slug = "my-app"
script_directory = os.path.dirname(os.path.abspath(sys.argv[0]))
icon_path = "C:\\Windows\\SystemApps\\MicrosoftWindows.Client.CBS_cw5n1h2txyewy\\WindowsBackup\\Assets\\WindowsBackup.ico"
make_shortcut(os.path.join(script_directory, f"main.exe {slug}"),name=lnk_name,
icon=icon_path,
terminal=False, desktop=True, startmenu=False, executable='')
=======main.py end=====================
Expected result (C:\Users\WDAGUtilityAccount\Desktop\My application.lnk) when running from C:\TestProj\ folder: C:\TestProj\python main.py
Generated shortcut points to: C:\TestProj\main.exe my-app
Unexpected result (C:\Users\WDAGUtilityAccount\Desktop\my application.lnk) when running from: C:\Program Files (x86)\TestProj:
C:\Program Files (x86)\TestProj\python main.py
Generated shortcut points to: C:\Windows\system32 C:\Program Files (x86)\TestProj\main.exe my-app
Unexpected result (C:\Users\WDAGUtilityAccount\Desktop\my application.lnk) when running from: C:\Path with spaces\TestProj
Generated shortcut points to: C:\Windows\system32 C:\Path with spaces\TestProj\main.exe my-app
Suggested fix in windows.py:
replace line in make_shortcut function wscript.Targetpath = '"%s"' % executable
Many thanks for the module!
Conditions to reproduce: Windows 10 SandBox
Install: python-3.12.3-amd64
Run commands in command prompt:
Full contents of requirements.txt (installed modules) - just for sanity check:
pyshortcuts==1.9.0
pywin32==306
=====main.py contents===============
=======main.py end=====================
Expected result (C:\Users\WDAGUtilityAccount\Desktop\My application.lnk) when running from C:\TestProj\ folder: C:\TestProj\python main.py
Generated shortcut points to: C:\TestProj\main.exe my-app
Unexpected result (C:\Users\WDAGUtilityAccount\Desktop\my application.lnk) when running from: C:\Program Files (x86)\TestProj:
C:\Program Files (x86)\TestProj\python main.py
Generated shortcut points to: C:\Windows\system32 C:\Program Files (x86)\TestProj\main.exe my-app
Unexpected result (C:\Users\WDAGUtilityAccount\Desktop\my application.lnk) when running from: C:\Path with spaces\TestProj
Generated shortcut points to: C:\Windows\system32 C:\Path with spaces\TestProj\main.exe my-app
Suggested fix in windows.py:
replace line in make_shortcut function
wscript.Targetpath = '"%s"' % executable
with the following:
The text was updated successfully, but these errors were encountered: