Unicode-aware file shortcuts in Windows

John Bauman john at baumanfamily.com
Sat Sep 17 07:39:22 CEST 2005


"Stanislaw Findeisen" <my_initials at nglogic.com> wrote in message 
news:dgfjg8$j0n$1 at achot.icm.edu.pl...
> Does anyone know how to create file shortcuts in Windows?
>
> The only way I know is like:
>
> ---------------------------------------------------------------
>
> import win32com.client
>
> wScriptShellObject = win32com.client.Dispatch("WScript.Shell")
> shortcutName = unicode("shortcut.lnk", "utf8")
> shortcut = wScriptShellObject.CreateShortcut(shortcutName)
> shortcut.TargetPath = <FULL PATH TO TARGET FILE>
> shortcut.Save()
>
> ---------------------------------------------------------------

I see that another way is available here: 
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/shellcc/platform/shell/programmersguide/shell_int/shell_int_programming/shortcuts/shortcut.asp
I haven't tried, and I don't have the knowledge to convert the C++ to 
Python, but it works at a lower level and may get around the bugs. It does 
seem that the name of the file isn't Unicode in their method, either, so I'm 
not sure if it'll work. 





More information about the Python-list mailing list