马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?立即注册
x
import os, winshell, win32com.client, Pythoncom
desktop = winshell.desktop()
#desktop = r"path to where you wanna put your .lnk file"
path = os.path.join(desktop, 'File Shortcut Demo.lnk')
target = r"C:\Users\lenovo\Documents\sample2.txt"
icon = r"C:\Users\lenovo\Documents\sample2.txt"
shell = win32com.client.Dispatch("WScript.Shell")
shortcut = shell.CreateShortCut(path)
shortcut.Targetpath = target
shortcut.IconLocation = icon
shortcut.save() |