-
-
Save fereria/b5db9f20ab6b47011a0e to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## -*- 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