How can I pass more than one command line argument via c#
- by user293392
I need to pass more than one command line argument via c# for a process called handle.exe:
http://www.google.com.mt/search?sourceid=chrome&ie=UTF-8&q=handle.exe
First, I need to run the executable file via ADMINISTRATOR permissions. This post has helped me achieve just that:
http://stackoverflow.com/questions/667381/programatically-run-cmd-exe-as-adminstrator-in-vista-c
But then comes the next problem of calling the actual line arguments such as "-p explore"
How can I specify the command line arguments together, or maybe consecutively?
Current code is as follows:
Process p = new Process();
ProcessStartInfo processStartInfo = new ProcessStartInfo("filePath");
processStartInfo.CreateNoWindow = true;
processStartInfo.UseShellExecute = false;
processStartInfo.RedirectStandardOutput = true;
processStartInfo.RedirectStandardInput = true;
processStartInfo.Verb = "runas";
processStartInfo.Arguments = "/env /user:" + "Administrator" + " cmd";
p.StartInfo = processStartInfo;
p.Start();
string output = p.StandardOutput.ReadToEnd();
p.WaitForExit();
Console.WriteLine(output);
Thanks