首先得安装 ActiveState ActivePython . 因为这个中带了 winshell 库
from os import path
import winshell
#----------------------------------------------------------------------
def create_shortcut_to_desktop(target,title):
"""Create shortcut to desktop"""
s = path.basename(target)
fname = path.splitext(s)[0]
winshell.CreateShortcut(
Path = path.join(winshell.desktop(), fname + '.lnk'),
Target = target,
Icon=(target, 0),
Description=title)
注:不支持win64