现在的位置: 首页 > 综合 > 正文

python 创建桌面快捷方式

2013年10月12日 ⁄ 综合 ⁄ 共 399字 ⁄ 字号 评论关闭

首先得安装 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

抱歉!评论已关闭.