[python-win32] Problem creating a shortcut

Tim Golden mail at timgolden.me.uk
Fri May 16 13:09:46 CEST 2008


Sorry, missed this one going through. Looks like
Roger's hit the nail on the head, though. Bizarre
behaviour by the IShellLink interface: I can't find
any kind of reference to this but I assume that
since the Path attribute of the link should *only*
contain an executable, there's no need for the
quotes -- which then confuse it when they're there
as it tries to make the executable into an absolute
path.

One small comment, Mike. Since you're using the
winshell module -- which I assume is the one from
my site -- why not use its CreateShortcut function?
It's basically just a light wrapper around the IShellLink
functionality which someone else mentioned:

<code>
import os, sys
import winshell

winshell.CreateShortcut (
 Path=os.path.join (winshell.desktop (), "shortcut.lnk"),
 Target=r"c:\Program Files\Mozilla Firefox\firefox.exe",
 Arguments="http://localhost",
 Description="Open http://localhost with Firefox"
)

</code>

But maybe you're using the WScript.Shell functionality
elsewhere as well?

TJG



More information about the python-win32 mailing list