如何创建具有两个目标的快捷方式 [英] How to create shortcuts having two target

查看:64
本文介绍了如何创建具有两个目标的快捷方式的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用以下脚本创建快捷方式:

I am creating a shortcut using the following script:

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

At oShellLink.TargetPath = "C:\Windows\System32\mshta.exe D:\path\to\file.hta" 它卡住了,因为目标路径中有一个空格.如何做到这一点?我也尝试过像这样操作字符串.

At oShellLink.TargetPath = "C:\Windows\System32\mshta.exe D:\path\to\file.hta" it's stuck as there is a space in the target path. How to accomplish this? I tried manipulating string like this also.

"C:\Windows\System32\mshta.exe" & " " & """" & "D:\PLR\software\plrplus.dll" & """"

推荐答案

如有疑问,请阅读 文档.

来自 TargetPath 属性 - 备注部分
此属性仅适用于快捷方式的目标路径.快捷方式的任何参数都必须放在参数的属性中.

命令的参数属于 Arguments 属性:

Arguments to a command belong in the Arguments property:

Set oShellLink = objShell.CreateShortcut("shortcut.lnk")
oShellLink.TargetPath = "C:\Windows\System32\mshta.exe"
oShellLink.Arguments = "D:\path\to\file.hta"
...
oShellLink.Save

这篇关于如何创建具有两个目标的快捷方式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆