I have this python3.6
code that creates Windows shortcuts:
from win32com.client import Dispatch
path_to_target = r"C:\Program Files\ピチャーム\pycharm64.exe"
path_to_shortcut = r"C:\Program Files\pycharm.lnk"
shell = Dispatch("WScript.Shell")
shortcut = shell.CreateShortCut(path_to_shortcut)
shortcut.Targetpath = path_to_target # exception here
shortcut.save()
If path_to_target
contains any non ascii characters I get an exception: Property '<unknown>.Targetpath' can not be set.
The code works OK and creates the proper shortcut if path_to_target
is only ascii characters.
How can I create shortcuts to targets that have unicode characters?
Is there alternative API to create Windows shortcuts?
from python3.6 create win32 shortcut with unicode
No comments:
Post a Comment