General discussion


Visual Basic TargetPath

By twhite ·
I have a Visual Basic script setup to create a Shortcut but there is a need for an additional variable to show at the end of the target path after the quote.

I.E. "D:\Program Files\Test\Testing.exe" CLIENT

I need to know how to get the word CLIENT to appear after the " in the Target Path Field

This is what I have:

If fso.FolderExists("D:\Program Files\Test") Then
TESTFolder = "D:\Program Files\Test"
ElseIf fso.FolderExists("C:\Program Files\Test") Then
TESTFolder = "C:\Program Files\Test"
End If

If TESTFolder <> "" Then

set FileShortcut = WshShell.CreateShortcut(ToolsFolder & "\Test V2.lnk")
FileShortcut.TargetPath = TESTFolder & "\Testing.exe"
FileShortcut.Description = "Test V2"
FileShortcut.WorkingDirectory = TESTFolder
FileShortcut.IconLocation = TESTFolder & "\MEDICAL.ICO"
End If

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Comments

Collapse -

by anandsoftwares In reply to Visual Basic TargetPath


You have to set target path like this

FileShortcut.TargetPath = """" & TESTFolder & "\Testing.exe"" CLIENT"



Collapse -

by twhite In reply to

Close but that gave me the following in the target:
"C:\"D:\Program Files\Test\Testing.exe" CLIENT"

When I need it to look like this:
"D:\Program Files\Test\Testing.exe" CLIENT

Collapse -

by Tony Hopkinson In reply to Visual Basic TargetPath

A nice readable way
Define a constant say delimiter = """"
testfolder= delimiter & testFolder & "\testing.exe" & delimiter & " CLIENT"

Collapse -

by twhite In reply to

Poster rated this answer.

Collapse -

by twhite In reply to Visual Basic TargetPath

This question was closed by the author

Related Discussions

Related Forums