[python-win32] Problem creating a shortcut

Mike Driscoll mdriscoll at co.marshall.ia.us
Fri May 16 19:43:19 CEST 2008


Tim Golden wrote:
> <div class="moz-text-flowed" style="font-family: -moz-fixed">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
>
>
> </div>

Good point. I am using your module (thanks!). Somehow I missed it's 
shortcut creating abilities. I do use the WScript.Shell earlier in my 
script, but I think it's just for other types of shortcut creation.

I'll have to look. It would be good not to have to import extra stuff.

Mike



More information about the python-win32 mailing list