| 12345678910111213141516171819202122232425 |
- import os
- import winshell
- from win32com.client import Dispatch
- def create_shortcut():
- # creates shortcut
- desktop = winshell.desktop()
- path = os.path.join(desktop, "Predespacho Regional.lnk")
- target = os.path.join(
- os.environ["LOCALAPPDATA"], "Merelec", "spr", "run.bat")
- wDir = desktop
- icon = os.path.join(os.environ["LOCALAPPDATA"],
- "Merelec", "spr", "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()
|