You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

调用WScript.Shell.CreateShortcut创建快捷方式单台设备报错求助

我在5台电脑上运行了相关代码,其中4台运行正常,仅1台返回报错,报错信息见下图:
报错截图

我的代码如下:

desktop = os.path.join(os.environ["HOMEPATH"], "Desktop")
shortcutpath = os.path.join(desktop, 'MeetingAssistant.lnk')
target = path + '\\MeetingAssistant.exe'
icon = imagefolder + '\\icon.ico'

time.sleep(1)
pythoncom.CoInitialize()
shell = win32com.client.Dispatch("WScript.Shell")
shortcut = shell.CreateShortCut(shortcutpath)
shortcut.WorkingDirectory = path
shortcut.Targetpath = target
shortcut.IconLocation = icon
shortcut.save() 

内容的提问来源于stack exchange,提问作者Wayne Gan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.10.02 11:48:03