如何使用多个目标创建快捷方式

时间:2016-09-15 12:21:34

标签: vb.net

我想创建的ShortCut为:

  

“C:\ Program Files \ ViceVersa Pro \ ViceVersa.exe”“c:\ users \ waseefur.rahman \ documents \ viceversa pro \ test 3.fsf”/ autocompare

我一直在尝试编码如下:

Dim shortcutPathName As String = "E:\VVTest\Z Create Shortcut" & "\MyShortcut.lnk"
Dim WshShell As WshShell = New WshShell
Dim MyShortcut As IWshRuntimeLibrary.IWshShortcut

MyShortcut = CType(WshShell.CreateShortcut("E:\VVTest\Z Create Shortcut" & "\MyShortcut.lnk"), IWshRuntimeLibrary.IWshShortcut)
MyShortcut.WorkingDirectory = "C:\Program Files\ViceVersa Pro"
MyShortcut.TargetPath = "C:\Program Files\ViceVersa Pro\ViceVersa.exe"
MyShortcut.Arguments = "c:\users\waseefur.rahman\documents\viceversa pro\test 4.fsf / autocompare"

MyShortcut.Description = "VV Shortcut"

MyShortcut.Save()

我得到结果:

  

“C:\ Program Files \ ViceVersa Pro \ ViceVersa.exe”c:\ users \ waseefur.rahman \ documents \ viceversa pro \ test 4.fsf / autocompare

即没有“”, 但我需要它:

  

“C:\ Program Files \ ViceVersa Pro \ ViceVersa.exe”“c:\ users \ waseefur.rahman \ documents \ viceversa pro \ test 3.fsf”/ autocompare

请问有什么建议吗。

1 个答案:

答案 0 :(得分:0)

尝试在您需要的地方添加转义引号:

MyShortcut.TargetPath = """C:\Program Files\ViceVersa Pro\ViceVersa.exe"""
MyShortcut.Arguments = """c:\users\waseefur.rahman\documents\viceversa pro\test 4.fsf"" / autocompare"