i have made a program using a button & it's fuction is opening an exe file & runnint this exe
my program open it only without running
i donot know what can i do?
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
AlanPosted Jun 17, 2007, 6:16 AM
This is really a question for the .NET Programming forums, Mohamed, but no matter :)
To run an .exe file from a .NET program, you need to be looking at the System.Diagnostics.Process class. Here's a quick example in C# :
Process proc = new Process();
proc.StartInfo.FileName = @"C:\myprogram.exe";
proc.Start();
proc.WaitForExit(); // if you want to wait until the executable has finished running
There's a lot you can do with the Process class, including passing command line arguments to the executable, and I'd have a read through the documentation if your needs are more sophisticated than the above example:
http://msdn2.microsoft.com/en-us/library/system.diagnostics.process(vs.80).aspx