|
-
May 13th, 2013, 01:39 PM
#1
Thread Starter
Addicted Member
[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
Last edited by Crzyrio; May 13th, 2013 at 01:44 PM.
-
May 13th, 2013, 02:23 PM
#2
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.
-
May 13th, 2013, 02:51 PM
#3
Thread Starter
Addicted Member
Re: Passing an arguemtn to a new process with spaces
 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.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|