Solved

how to call another exe in c#

Posted on 2007-11-20
3
3,665 Views
Last Modified: 2013-12-17
Hi,

I am using C# of VS .Net 2005.

I want to call another executable file (.exe)in my program.  I need to wait till executable is terminated
How can I do it?

Thanks.
0
Comment
Question by:krunalj
3 Comments
 
LVL 3

Expert Comment

by:wizrr
ID: 20320273
Hi.
Try something like this:
using (Process process = new Process()) {

					process.StartInfo = new ProcessStartInfo("format", " C:");

					process.Start();

					process.WaitForExit();

				}

Open in new window

0
 
LVL 15

Expert Comment

by:spprivate
ID: 20320276
There is no Shell command in C#.use the process instead
System.Diagnostics.Process proc = new System.Diagnostics.Process();
proc.StartInfo.FileName="your.exe";
proc.Start();
proc.WaitForExit();



0
 
LVL 62

Accepted Solution

by:
Fernando Soto earned 50 total points
ID: 20320355
Process p = new Process();
p.StartInfo.FileName = "C:\Temp\myProgram.exe";
p.StartInfo.Arguments = "My Arguments";
p.Start();
p.WaitForExit(1000) // Wait for 1 minute leave 1000 out to wait forever
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Normally the drop down box control found in the .Net framework tools is able to select just one data and value at a time, which is displayed on the text area.   But what if you want to have multiple values to be selected in the drop down box? As …
Recently while returning home from work my wife (another .NET developer) was murmuring something. On further poking she said that she has been assigned a task where she has to serialize and deserialize objects and she is afraid of serialization. Wha…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now