[Tutor] making a shortcut in windows

Walter Prins wprins at gmail.com
Tue Sep 4 18:10:46 CEST 2012


Hi,

On 4 September 2012 15:44, Wayne Werner <wayne at waynewerner.com> wrote:
>> I actually just want the functionality of a shortcut so that I can put an
>> icon on the desktop. symlink allows that in Unix (and a few other
>> capabilities that I'm not that intersted in) and just want something
>> equivalent to the menu item for making a shortcut in Windows.
>
>
> At least in Windows 7+, you can use the mklink command (as administrator):
>
> import subprocess
> subprocess.check_call(['mklink',
>                        '/D', #Use /H for a hard link
>                        '\users\yourname\desktop\yourfile.txt',
>                        '\path\to\yourfile.txt'])
>
> HTH,
> Wayne

Yes, but as already noted symbolic links are a newish feature that is
not available on older OS's, so the original poster probably wants to
look at API's to create actual shortcut's given that he's targeting
WinXP etc.

Regards

Walter


More information about the Tutor mailing list