Skip to content

Instantly share code, notes, and snippets.

@fereria
Created March 8, 2015 12:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save fereria/b5db9f20ab6b47011a0e to your computer and use it in GitHub Desktop.
Save fereria/b5db9f20ab6b47011a0e to your computer and use it in GitHub Desktop.
## -*- coding: utf-8 -*-
import os.path
import win32com.client
def createShortCut(path,scFileName,icon=None):
"""
デスクトップにショートカットファイルを作成する
"""
if icon == None:
icon = path
shell = win32com.client.Dispatch('WScript.shell')
desktop = shell.SpecialFolders('Desktop')
shCut = shell.CreateShortcut(os.path.join(desktop,scFileName+".lnk"))
shCut.TargetPath = path
shCut.WindowStyle = 1
shCut.IconLocation = icon
shCut.WorkingDirectory = desktop
shCut.Save()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment