调用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
相关产品推荐
相关产品推荐

