I am trying to pass multiple command line arguments to an application. The problem is that some of the arguments have spaces in them. I seem to be only able to send it as one argument, or seporated on the spaces.
So here is a simplified version of what I am doing.
VB Code:
Dim CmdArgs() As String = {"C:\Program Files\Application\Recordings\", "Agr2", "Arg3"} Dim arg As String = "" For c As Integer = 0 to CmdArgs.Length - 1 arg &= """" & CmdArgs(c) & """" & " " Next arg = arg.Trim Dim psi As New ProcessStartInfo psi.Arguments = arg psi.FileName = AppPathAndName psi.RedirectStandardOutput = True psi.UseShellExecute = False Dim p As New Process p.StartInfo = psi p.Start()
The way the code is above the argument string looks like this
"C:\Program Files\Application\Recordings\" "Arg2" "Arg3"
This only passes 1 argument that looks like this:
C:\Program Files\Application\Recordings\" Arg2 Arg3
If I add quotes a quote to the begining and end of arg this is what it looks like
""C:\Program Files\Application\Recordings\" "Arg2" "Arg3""
This passes 4 arguments:
C:\Program
Files\Application\Recordings\"
Arg2
Arg3"
notice the " in red


Reply With Quote
