running a batch file from a command window launched from a c sharp program

Complete

OSNN Addict
Joined
25 Aug 2005
Messages
94
I have been able to launch a batch file from a C# program in a number of ways.

Duncan Mackenzie's blog on msdn shows a number of ways how it can be done and I have tried them. (http://blogs.msdn.com/csharpfaq/archive/2004/06/01/146375.aspx).

But I have a unique problem. The batch file launches a program that seems to require that a command window (cmd) be open when it runs. Because of this, the batch file works if I launch it from a command line, but when I launch it in a C# program, an exception is thrown.

So my question is this. How can I open a cmd window from C# and feed it the command to run the batch routine?
 
why not just launch "cmd <path to batch file>" instead of "<path to batch file>\<batchfile>"?
 

Members online

No members online now.

Latest profile posts

Also Hi EP and people. I found this place again while looking through a oooollllllldddd backup. I have filled over 10TB and was looking at my collection of antiques. Any bids on the 500Mhz Win 95 fix?
Any of the SP crew still out there?
Xie wrote on Electronic Punk's profile.
Impressed you have kept this alive this long EP! So many sites have come and gone. :(

Just did some crude math and I apparently joined almost 18yrs ago, how is that possible???
hello peeps... is been some time since i last came here.
Electronic Punk wrote on Sazar's profile.
Rest in peace my friend, been trying to find you and finally did in the worst way imaginable.

Forum statistics

Threads
62,015
Messages
673,495
Members
5,625
Latest member
vinit
Back