我正在使用以下脚本创build一个快捷方式:
Set oShellLink = objShell.CreateShortcut("shortcut.lnk") oShellLink.TargetPath = "C:\Windows\System32\mshta.exe D:\path\to\file.hta" oShellLink.WindowStyle = 1 oShellLink.IconLocation = "logo.ico" oShellLink.Description = "app" oShellLink.WorkingDirectory = desktop oShellLink.Save
在oShellLink.TargetPath = "C:\Windows\System32\mshta.exe D:\path\to\file.hta"
中,由于目标path中有空格,所以卡住了。 如何做到这一点? 我也尝试过这样操纵string。
"C:\Windows\System32\mshta.exe" & " " & """" & "D:\PLR\software\plrplus.dll" & """"
如有疑问,请阅读文档 。
从TargetPath属性 – 备注部分
该属性仅用于快捷方式的目标路径。 任何参数的快捷方式必须放置在参数的属性。
一个命令的Arguments
属于Arguments
属性:
Set oShellLink = objShell.CreateShortcut("shortcut.lnk") oShellLink.TargetPath = "C:\Windows\System32\mshta.exe" oShellLink.Arguments = "D:\path\to\file.hta" ... oShellLink.Save