What I need to do:
I have a path (copied from a working shortcut) to an .exe that I need to launch from my vb.net application. Following Path:
"C:\Program Files (x86)\Citrix\ICA client\pnagent.exe" /CitrixShortcut: (2) /QLaunch "Farm1:ADS @ Citrix"
My problem:
I cannot figure out how to do this. My best guess was
Process.Start("cmd", "/k " & path)
But that always ends up with cmd giving back
'C:\Program' is not recognized as an internal or external ...
I know this is due to the path not being properly escaped, but I can't figure out how to do it properly. I know about using Double-Doubblequotes ("") but I couldn't get that work either.
If anyone can point me to a maybe better way to do this than Process.Start() I'd be very happy aswell!
I think the Process.Start() overload you want is
Process.Start(program, args).
... which would give you
Process.Start("C:\Program Files (x86)\Citrix\ICA client\pnagent.exe", "/CitrixShortcut: (2) /QLaunch ""Farm1:ADS @ Citrix"" ")
Edit / Clarification:
cmd /k
launches the command shell (aka "DOS prompt") but keeps it open after running the specified command (as opposed to cmd /c
which executes the command and then closes the shell).
You typically only start cmd
if you want to execute a shell built-in like DIR
or COPY
.