473,382 Members | 1,545 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,382 software developers and data experts.

Wait For Process to Finish

I have written a small Console application that executes the following line,
amongst other things:

System.Diagnostics.Process.Start(currentWorkingDir ectory +
@"\backup_files.cmd");

My Console app is NOT waiting for the execution of backup_files.cmd to
finish.

How can I cause my console app to wait for backup_files.cmd to finish before
proceeding?

Thanks!
Nov 17 '05 #1
2 19543
In message <OO*************@TK2MSFTNGP14.phx.gbl>, Jordan S <A@B.COM>
writes
I have written a small Console application that executes the following line,
amongst other things:

System.Diagnostics.Process.Start(currentWorkingDi rectory +
@"\backup_files.cmd");

My Console app is NOT waiting for the execution of backup_files.cmd to
finish.


using(Process p = Process.Start(path))
{
while(!p.HasExited)
{
Console.WriteLine("Waiting...");
Thread.Sleep(5000);
}
}

--
Steve Walker
Nov 17 '05 #2
You can use p.WaitForExit();

"Steve Walker" <st***@otolith.demon.co.uk> wrote in message
news:PP**************@otolith.demon.co.uk...
In message <OO*************@TK2MSFTNGP14.phx.gbl>, Jordan S <A@B.COM>
writes
I have written a small Console application that executes the following line,amongst other things:

System.Diagnostics.Process.Start(currentWorkingDi rectory +
@"\backup_files.cmd");

My Console app is NOT waiting for the execution of backup_files.cmd to
finish.


using(Process p = Process.Start(path))
{
while(!p.HasExited)
{
Console.WriteLine("Waiting...");
Thread.Sleep(5000);
}
}

--
Steve Walker

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Vivien Mallet | last post by:
Hello, I use popen2.Popen4 and I experienced problems with it. Let me show you with an example. The following script is called "lines" (it prints lines of 'X'): ---------------------...
1
by: Mark Foong | last post by:
Hi all, I have a webpage that does a long process in javascript. I am opening a popup page while this process is running. The only problem is, the popup page doesnt finish loading and the popup...
1
by: Ken Barz | last post by:
So close so close. Thanks Fergus and Herfried. I need one more step for this to work. I get my program to run ok, but I need something in there to tell it to wait for it to finish before it...
2
by: Aaron Ackerman | last post by:
I have a very small console taks that i perform at the very beginning of running my app for the first time. I want to be able to wait until this Process is finished and then initiate a reboot of...
5
by: Kevin Hodgson | last post by:
I'm trying to launch a command line utility from my VB.NET App, In my function I create a process and launch the executable, and need to wait for it to exit, so that the calling code can move the...
18
by: Coder | last post by:
Howdy everybody! How do I do the following... while (myVary != true){}; Obviously I do not want to use 100% of the processor to stay in this infinite loop till myVar == true. But wait do I...
1
by: Divyesh | last post by:
Hello, I need to call external application from my C# application. I can use Process.Start(<FileName>) for that but I also need to wait for that application to finish before I process. Any...
1
by: meihome | last post by:
I have a pretty long process (40 seconds) script. It is kicked off from one controller action from web browser. The problem is, the Rails does not wait until the process is done. It actually...
5
by: Jim | last post by:
I have a form in an Access 2003 db that calls (using shell - thanks to this newsgroup) a Vb.net program I wrote to parse a text file. The call works fine. The VB parses the file correctly. How...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.