[Tutor] making a shortcut in windows

Wayne Werner wayne at waynewerner.com
Tue Sep 4 16:44:01 CEST 2012


On Tue, 4 Sep 2012, Garry Willgoose wrote:

> Oscar,
> 
> 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


More information about the Tutor mailing list