Re: Process.Start Problem with WaitForExit(), WaitForExit DOES NOT WA

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance

From: Richard A. Lowe (chadich_at_yumspamyumYahoo.com)
Date: 12/22/04


Date: Tue, 21 Dec 2004 22:46:13 -0600

Well, what are you batch files doing? It's possible, I guess, that they are
starting other processes in a way that they do not block the .bat file
process.

-- 
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"James Li" <JamesLi@discussions.microsoft.com> wrote in message 
news:BCAA32AA-8144-41DF-9018-B7C2D7E8E337@microsoft.com...
>I have the code below, the first process takes about 10 minutes to finish.
> But the waitForExit doesn't seem to wait when I debug the program, it go
> immediately to execute code after the WaitForExit().  The first process
> basically launch a DOS batch file to do some task, am I missing anything?
>
> executable = "setup_listener.bat";
> process1 = new Process();
> process1.StartInfo.UseShellExecute = false;
> process1.StartInfo.CreateNoWindow = false;
> process1.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
> process1.StartInfo.FileName = executable;
> //process1.StartInfo.RedirectStandardOutput = true;
> process1.Start();
> process1.WaitForExit();
>
> executable = "create_xdb_service.bat";
> process3 = new Process();
> process3.StartInfo.UseShellExecute = false;
> process3.StartInfo.CreateNoWindow = false;
> process3.StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
> process3.StartInfo.FileName = executable;
> //process3.StartInfo.RedirectStandardOutput = true;
> process3.Start();
> process3.WaitForExit(); 


Relevant Pages

  • Re: [ Attn: Randy ] Ad-hoc Parsing?
    ... > It can execute the .com file as easily as a command.com or cmd.exe batch file can. ... Is this true for any new Linux distribution. ... > Bash scripts can drop and launch .com files as easily as DOS batch files can. ...
    (alt.lang.asm)
  • Re: Process.Start Problem with WaitForExit(), WaitForExit DOES NO
    ... I'm going to bet that's why - can you maybe start the installer from your ... what are you batch files doing? ... the first process takes about 10 minutes to ... >>> immediately to execute code after the WaitForExit(). ...
    (microsoft.public.dotnet.languages.csharp)
  • Process not giving prompt back with Runtime.exec!
    ... after I execute a couple of batch files using the Runtime.exec method. ... I wrote an application in Java on the Win XP platform that basically ... Since the server process was started from a Java ...
    (comp.lang.java.help)
  • Re: Windows cannot access the specified device, path, or file........
    ... This posting is provided "AS IS" with no warranties, and confers no rights. ... not execute any exe or batch files off a different machine? ...
    (microsoft.public.windows.server.general)
  • Re: remote machine execution
    ... I use robocopy and copy my files to remote machine directory. ... i wish to do is to execute the batch files on the remote machines directory. ...
    (microsoft.public.windows.server.scripting)