| 123456789101112131415161718192021222324252627 |
- import os
- import winshell
- from win32com.client import Dispatch
- def create_shortcut():
- # creates shortcut
- desktop = winshell.desktop()
- path = os.path.join(desktop, "SimSDT.lnk")
- target = os.path.join(
- os.environ["LOCALAPPDATA"], "Merelec", "simsdt", "run.bat")
- wDir = os.path.join(
- os.environ["LOCALAPPDATA"], "Merelec", "simsdt")
- icon = os.path.join(os.environ["LOCALAPPDATA"],
- "Merelec", "simsdt", "app.ico")
- shell = Dispatch('WScript.Shell')
- shortcut = shell.CreateShortCut(path)
- shortcut.Targetpath = target
- shortcut.WorkingDirectory = wDir
- shortcut.IconLocation = icon
- shortcut.save()
- if __name__ == "__main__":
- create_shortcut()
|