Hi, On 4 September 2012 02:57, Garry Willgoose <garry.willgo...@newcastle.edu.au> wrote: > I want to put a shortcut onto the desktop in windows (XP and later) in Python > 2.6 or later. In Unix its easy using os.symlink but I can't find anything > equivalent for windows. My searches on the web led me to the code below but > the code returns the error > > AttributeError: function 'CreateSymbolicLinkW' not found > so does anybody have any suggestions?
IIRC and as implied by other responses so far, "Symbolic Links" are an NTFS feature only relatively recently added to NTFS. Creating a Symbolic Link (whether on Windows or elsewhere) is not the same as creating a "Shortcut" in Windows, even though they can in some contexts (e.g. a GUI desktop environment) be used to fulfil the same role. Anyway, to be backwards compatible with Win XP you should be creating a "Shortcut", more properly known as a "Shell link". See here: http://msdn.microsoft.com/en-us/library/windows/desktop/bb776891%28v=vs.85%29.aspx Basically you need to use the IShellLink COM interface to create the link. You can use PythonCOM to do this (not sure if you'll be happy about adding a dependency on COM to your application though), either way, here's a presentation that also mentions IShellLink (note it's a bit old so make allowances for the age): http://starship.python.net/~skippy/conferences/tools99/html/ppframe.htm Walter _______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: http://mail.python.org/mailman/listinfo/tutor