python生成应用程序的快捷方式
代码:
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()
执行效果:
本文来自博客园,作者:河北大学-徐小波,转载请注明原文链接:https://www.cnblogs.com/xuxiaobo/p/17047449.html