For Programmers: Free Programming Magazines  


Home > Archive > C# > May 2005 > running a windows command...









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author running a windows command...
gloria

2005-05-26, 3:57 am

I would like to exec a windows script. Is there a way I can call a
script from my application, wait for it to complete and then proceed
with the rest of my code? I'm not even sure what commands I would use
to even search on. Can someone please point me in the right direction?

Thanks!

--gloria

gloria

2005-05-26, 9:00 pm

Found what I needed. See below:

Process putP = new Process();
putP.StartInfo.FileName = "script";
putP.StartInfo.Arguments = " arg1 arg2 etc";

putP.StartInfo.UseShellExecute = false;
putP.StartInfo.WorkingDirectory = BAXscriptsdirStr;

//Start the process
putP.Start();

//Wait for the process to exit.
putP.WaitForExit();

Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com