This is a very simple question, but cant figure out a way to do it. I want
to know how to pass multiple parameters as arguments to an external process.
I want to call an exe with following arguments :- MyApp.exe "C:\Some
Directory\File.txt" /A /T . But the Process.Start or the
StartInfo.Argumnets only let you give one string as an argument. Therefore
it is not possible to pass a set of arguments like I want (one argument
having double quotes). When I pass the above in one string the argument is
given as "C:\Some Directory\File.txt /A /T" to the application which is
wrong (the application take it as a one parameter and tries to treat is as a
file). How can I do it ? Any help greatly appreciated.

Re: Need help passing multiple arguments to an external executable. by Sijin

Sijin
Thu Sep 09 02:18:04 CDT 2004

Try escaping the inner quotes

ProcessStartInfo.Arguments = @" ""C:\SomeDirectory\File.txt"" /A /T";

Sijin Joseph
http://www.indiangeek.net
http://weblogs.asp.net/sjoseph



H.B wrote:
> This is a very simple question, but cant figure out a way to do it. I want
> to know how to pass multiple parameters as arguments to an external process.
> I want to call an exe with following arguments :- MyApp.exe "C:\Some
> Directory\File.txt" /A /T . But the Process.Start or the
> StartInfo.Argumnets only let you give one string as an argument. Therefore
> it is not possible to pass a set of arguments like I want (one argument
> having double quotes). When I pass the above in one string the argument is
> given as "C:\Some Directory\File.txt /A /T" to the application which is
> wrong (the application take it as a one parameter and tries to treat is as a
> file). How can I do it ? Any help greatly appreciated.
>
>