Discussion Locked

Visual Basic TargetPath

0 helpful
5 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

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"
FileShortcut.Save
End If

5 replies

by anandsoftwares

Hi

You have to set target path like this

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

Thanks

Anand.

by twhite

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

by tony hopkinson

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

This discussion is closed to new replies.