Reputation: 11540
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"
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" & """"
Upvotes: 1
Views: 2853
Reputation: 200283
When in doubt, read the documentation.
From TargetPath property - Remarks Section
This property is for the shortcut's target path only. Any arguments to the shortcut must be placed in the Argument's property.
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
Upvotes: 7