python - 创建快捷方式返回错误,但在其他计算机上工作正常
问题描述
我在 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()
解决方案
推荐阅读
- google-apps-script - 在 Googles Sheet 宏语言中移动“活动”单元格
- r - Shiny 可以打印/添加/绘制从输入中提取的值到绘图(nomogam)吗?
- c# - 带索引的 OpenGL / OpenTK 绘图:尝试读取或写入受保护的内存问题
- javascript - 如何使用 D3 在现有时间序列图中将线的形状更改为闭合条
- swift - 在 CoreData 中排序(swift)
- javafx - 如何正确实现存储 JavaFX 文本元素的数组?
- java - 如何修复“找不到局部变量”错误?
- android - Xamarin - Android 图标太小
- sublimetext3 - 崇高文本中的实时预览突出显示
- html - 如何在C中将域和路径与URL分开?