创建快捷方式
import os
from win32com.client import Dispatch
def create_shortcut(target_path, shorcut_path):
shell = Dispatch('WScript.Shell')
shortcut = shell.CreateShortcut(shorcut_path)
shortcut.TargetPath = target_path
shortcut.Save()
if __name__ == '__main__':
desktop_path = os.path.join(os.path.expanduser('~'), 'Desktop')
target_path = r'E:\Work\space\raspberry\test.py'
shortcut_path = os.path.join(desktop_path, 'Shortcut.lnk')
create_shortcut(target_path, shortcut_path)
快捷方式-属性-目标修改为 %windir%\system32\cmd.exe /k python test.py debug
标签:__,target,python,shortcut,--,path,快捷方式,os From: https://www.cnblogs.com/147258llj/p/18163648