代码:
import os,winshell from win32com.client import Dispatch path = r"D:/workspace/wwwroot82/pyjiankong/dist/test.lnk" # Path to be saved (shortcut) target = r"D:/workspace/wwwroot82/pyjiankong/dist/test.exe" # The shortcut target file or folder work_dir = os.path.dirname(target) # The parent folder of your file shell = Dispatch('WScript.Shell') shortcut = shell.CreateShortCut(path) shortcut.Targetpath = target shortcut.WorkingDirectory = work_dir shortcut.save()
执行效果:
标签:dist,target,python,shortcut,生成,pyjiankong,应用程序,file,path From: https://www.cnblogs.com/xuxiaobo/p/17047449.html