Hey all,
I made a c# application that starts an another applction using the processstartinfo.
Everything seemed to be 5/5 until I started using arguments.
CODE
//How to Wait for a Shelled Process to Finish
//Get the path to the system folder.
string sysFolder =
Environment.GetFolderPath(Environment.SpecialFolder.System);
//Create a new process info structure.
ProcessStartInfo pInfo = new ProcessStartInfo();
//Set the file name member of the process info structure.
pInfo.FileName = "msaccess";
pInfo.Arguments = @"C:\Wolf Lair\WorkDeskTemp\"+username+@"\WolfDeskApp2k3.mdb"+runtime+macros;
//Start the process.
Process p = Process.Start(pInfo);
//Wait for the window to finish loading.
p.WaitForInputIdle();
//Wait for the process to end.
p.WaitForExit();
The problem is that when I use the pInfo.Arguments it provides the arguments in a strange string.
The argument works when I type it into a cmd prompt.
The argument is:
"c:\Wolf Lair\WorkDeskTemp\Corliss\WolfDeskApp2k3.mdb" /runtime /X _AutoExec
This argument assumes that the users name is corliss....which is used just for examples purpose.
In C# the argument is passed as invalid when I run it. I think it is because it is passed with quotes around the whole argument.
Any help is greatly needed.