I just posted a question regarding this, albeit with an always changing
number of arguments. This is how I've been able to get all the arguments
passed correctly, when the number of arguments is always static. Just
modify the 'applaunch.StartInfo.Arguments' line to adjust the number of
arguments accordingly. Each space between arguments, or even in a
filename/path, represents an increase in arrayCount. Let me know how it
goes...
Dim applaunch As Process = New Process()
Dim arrayCount As Integer, appArgs() As String
'pull external exe path/name and args into array, then count array items
appArgs = System.Environment.GetCommandLineArgs
For arrayCount = 0 To UBound(appArgs)
Next arrayCount
applaunch.StartInfo.FileName = appArgs(1)
applaunch.StartInfo.Arguments = appArgs(2) & " " & appArgs(3) & " " &
appArgs(4)
"Colmag" <Co****@discussions.microsoft.com> wrote in message
news:49**********************************@microsof t.com...
I'm running a console application (ghostscript) by starting it as a
process with arguments.
The problem i'm having is that it's falling over when I pass a file
containing spaces in the filename or filepath.
Anyone know how to get around this? (i've tried putting the file in
quotes, but it doesn't seem to work e.g. -sPDFname#"filename")