Click here to Skip to main content
16,021,823 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
proc.StartInfo.Arguments = "D:\Pre Requisite Utility";


Am passing path string as argument, but am getting this "D:\Pre" in other application. this is whole one path but spaces are making it as 3 arguments, "D:\Pre" ,"Requisite","Utility". i want to send complete path as one. how can i do this.


Thanks in advance for help.
Posted

Arguments property is a list of arguments, separated by space.

If you want to pass an argument (or more than one) containing spaces, you have to surround them with double quotation marks.

proc.StartInfo.Arguments = "D:\Pre Requisite Utility";


have to be changed to

proc.StartInfo.Arguments = "\"D:\\Pre Requisite Utility\"";


When you have multiple arguments, you have to surround them one by one, like:

proc.StartInfo.Arguments = "\"First argument\" \"Second argument\" \"Third argument\"";


Note that this is the same behavior from old DOS.

Regards,
Daniele.
 
Share this answer
 
Comments
Waqas Ahmad Abbasi 8-Jan-13 4:35am    
Thanks, this is what I was looking for.
right now am converting spaces into %,
.Replace(' ','%') 
but is there another better way to do this?
 
Share this answer
 
hi dear
pls use this.

proc.StartInfo.Arguments = (@"D:\Pre Requisite Utility").Replace(' ','%');

thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900