[python-win32] Re: How to create Windows directory shortcut from Python
G. Ken Holman
Tue, 18 Mar 2003 21:23:38 -0500
With many thanks to Paul Prescod who related the answer to me off-list, I
downloaded the Windows extensions found at:
and used the following code that created a directory shortcut on my T drive
named "test" that points to the "ftemp" directory (also on T):
shell = win32com.client.Dispatch("WScript.Shell")
shortcut = shell.CreateShortCut("t:\\test.lnk")
shortcut.Targetpath = "t:\\ftemp"
Note that when I used "/" instead of "\\" in the pathnames the shortcut was
*not* created properly.
At 2003-03-17 15:34 -0500, I wrote:
>I'm wondering if anyone has figured out how to create a Windows directory
>shortcut (Windows equivalent of a linked directory) from within a Python
>I can create a shortcut from the Windows Explorer by a right-click copy
>and selecting "Create Shortcuts Here" ... I'm looking for a Python
>solution to do the same action.
>I had anticipated the Windows implementation of os.symlink() would have
>done it, but there appears to be no implementation of os.symlink() under
>I could find nothing in a search of the archive of this list.
>Thanks for any help you can be!
Upcoming hands-on in-depth XSLT/XPath and/or XSL-FO
North America: June 16-20, 2003
G. Ken Holman mailto:gkholman@CraneSoftwrights.com
Crane Softwrights Ltd. http://www.CraneSoftwrights.com/z/
Box 266, Kars, Ontario CANADA K0A-2E0 +1(613)489-0999 (F:-0995)
ISBN 0-13-065196-6 Definitive XSLT and XPath
ISBN 0-13-140374-5 Definitive XSL-FO
ISBN 1-894049-08-X Practical Transformation Using XSLT and XPath
ISBN 1-894049-10-1 Practical Formatting Using XSL-FO
Male Breast Cancer Awareness http://www.CraneSoftwrights.com/z/bc