[RESOLVED] Passing an arguemtn to a new process with spaces
Hey,
I have run into an interesting problem today and not sure how to work around it.
In my program I use the Process.Start Method (String, String)
http://msdn.microsoft.com/en-us/library/h6ak8zt5.aspx
The file it is running is a VB Script and the argument is a path as to where the output file from the script will be save e.g "C:\Documents and Settings\rdlyma\Desktop\"
I get the path in vb like this
vb.net Code:
Dim forlder As String = Environment.GetFolderPath(Environment.SpecialFolder.Desktop) & "\MSU\test"
Now instead of it taking the entire path as one argument, the path is broken up into arguments whereever there is a space. so "C:\Documents and Settings\rdlyma\Desktop\"
become "C:\Documents" "and" "Settings\rdlyma\Desktop\"
vb.net Code:
if Wscript.Arguments.Count > 0 then
xmlDoc.Save Wscript.Arguments(0) & ".xml"
end if
that is how it is used in the script
Re: Passing an arguemtn to a new process with spaces
You can get around the issue in the Windows Shell or the console by placing such paths inside double quotes so I'd wager you can do it for Process.Start.
Re: Passing an arguemtn to a new process with spaces
Quote:
Originally Posted by
Niya
You can get around the issue in the Windows Shell or the console by placing such paths inside double quotes so I'd wager you can do it for Process.Start.
Thanks!! Worked perfectly.