Powered by Python: How to create Windows Shortcuts

import sys
import win32com.client

def CreateShortcut(WhereSrc, WhereShortcut, ShortcutName):
    """ This function creates a Windows shortcut for a directory or file,
        WhereSrc:      path to a directory or file
        WhereShortcut: path to the shortcut being placed
        ShortcutName:  name of the Shortcut
        Copyright @ Tomgee, 2007

    shell = win32com.client.Dispatch("WScript.Shell")
    shortcut = shell.CreateShortCut(WhereShortcut + "\\" + ShortcutName + ".lnk")
    shortcut.Targetpath = WhereSrc
Post a comment or leave a trackback: Trackback URL.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: