Python,使用两条路径创建快捷方式

时间:2018-07-02 22:05:06

标签: python

我试图在计算机或闪存驱动器上创建具有2条路径的快捷方式,为此我使用此代码

shell = Dispatch('WScript.Shell')
        shortcut = shell.CreateShortCut(usbname+i+".lnk")
        shortcut.Targetpath=r'"f:\tx.txt" "f:\lll"'
        shortcut.save()

但是此代码返回的错误是

Traceback (most recent call last):
  File "C:/Users/Ashraf/PycharmProjects/first/usb.py", line 27, in <module>
    shortcut.Targetpath=r'"f:\tx.txt" "f:\lll"'
  File "C:\Users\Ashraf\PycharmProjects\first\venv\lib\site-packages\win32com\client\dynamic.py", line 581, in __setattr__
    raise AttributeError("Property '%s.%s' can not be set." % (self._username_, attr))
AttributeError: Property '<unknown>.Targetpath' can not be set.

Process finished with exit code 1

有什么帮助吗?

0 个答案:

没有答案