473,569 Members | 2,572 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

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.StartI nfo.UseShellExe cute = false;
process1.StartI nfo.CreateNoWin dow = false;
process1.StartI nfo.WindowStyle = ProcessWindowSt yle.Hidden;
process1.StartI nfo.FileName = executable;
//process1.StartI nfo.RedirectSta ndardOutput = true;
process1.Start( );
process1.WaitFo rExit();

executable = "create_xdb_ser vice.bat";
process3 = new Process();
process3.StartI nfo.UseShellExe cute = false;
process3.StartI nfo.CreateNoWin dow = false;
process3.StartI nfo.WindowStyle = ProcessWindowSt yle.Hidden;
process3.StartI nfo.FileName = executable;
//process3.StartI nfo.RedirectSta ndardOutput = true;
process3.Start( );
process3.WaitFo rExit();
Nov 16 '05 #1
3 22488
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" <Ja*****@discus sions.microsoft .com> wrote in message
news:BC******** *************** ***********@mic rosoft.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.StartI nfo.UseShellExe cute = false;
process1.StartI nfo.CreateNoWin dow = false;
process1.StartI nfo.WindowStyle = ProcessWindowSt yle.Hidden;
process1.StartI nfo.FileName = executable;
//process1.StartI nfo.RedirectSta ndardOutput = true;
process1.Start( );
process1.WaitFo rExit();

executable = "create_xdb_ser vice.bat";
process3 = new Process();
process3.StartI nfo.UseShellExe cute = false;
process3.StartI nfo.CreateNoWin dow = false;
process3.StartI nfo.WindowStyle = ProcessWindowSt yle.Hidden;
process3.StartI nfo.FileName = executable;
//process3.StartI nfo.RedirectSta ndardOutput = true;
process3.Start( );
process3.WaitFo rExit();

Nov 16 '05 #2
It is calling the setup.exe of a third party application, which launches a
java program to do some installation tasks, file copies, write registry,
create windows services, etc.

"Richard A. Lowe" wrote:
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" <Ja*****@discus sions.microsoft .com> wrote in message
news:BC******** *************** ***********@mic rosoft.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.StartI nfo.UseShellExe cute = false;
process1.StartI nfo.CreateNoWin dow = false;
process1.StartI nfo.WindowStyle = ProcessWindowSt yle.Hidden;
process1.StartI nfo.FileName = executable;
//process1.StartI nfo.RedirectSta ndardOutput = true;
process1.Start( );
process1.WaitFo rExit();

executable = "create_xdb_ser vice.bat";
process3 = new Process();
process3.StartI nfo.UseShellExe cute = false;
process3.StartI nfo.CreateNoWin dow = false;
process3.StartI nfo.WindowStyle = ProcessWindowSt yle.Hidden;
process3.StartI nfo.FileName = executable;
//process3.StartI nfo.RedirectSta ndardOutput = true;
process3.Start( );
process3.WaitFo rExit();


Nov 16 '05 #3
I'm going to bet that's why - can you maybe start the installer from your
process? Worth seeing if it will block when you start it directly
--
C#, .NET and Complex Adaptive Systems:
http://blogs.geekdojo.net/Richard
"James Li" <Ja*****@discus sions.microsoft .com> wrote in message
news:09******** *************** ***********@mic rosoft.com...
It is calling the setup.exe of a third party application, which launches a
java program to do some installation tasks, file copies, write registry,
create windows services, etc.

"Richard A. Lowe" wrote:
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" <Ja*****@discus sions.microsoft .com> wrote in message
news:BC******** *************** ***********@mic rosoft.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.StartI nfo.UseShellExe cute = false;
> process1.StartI nfo.CreateNoWin dow = false;
> process1.StartI nfo.WindowStyle = ProcessWindowSt yle.Hidden;
> process1.StartI nfo.FileName = executable;
> //process1.StartI nfo.RedirectSta ndardOutput = true;
> process1.Start( );
> process1.WaitFo rExit();
>
> executable = "create_xdb_ser vice.bat";
> process3 = new Process();
> process3.StartI nfo.UseShellExe cute = false;
> process3.StartI nfo.CreateNoWin dow = false;
> process3.StartI nfo.WindowStyle = ProcessWindowSt yle.Hidden;
> process3.StartI nfo.FileName = executable;
> //process3.StartI nfo.RedirectSta ndardOutput = true;
> process3.Start( );
> process3.WaitFo rExit();


Nov 16 '05 #4

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

Similar topics

3
3071
by: Wardeaux | last post by:
All, I've written a "setup" wrapper that calls a sequence of "setup.exe", and all works except when I call the setup.exe for the MSDE, then it gets about half way through and then hangs... The MSDE setup works fine from a CMD prompt... anyone know of articles or known issues with this technique, and what are my alternatives to having my...
4
1820
by: Piedro | last post by:
Hi group I'm trying to run the msde setup from my program with the following piece of code and the msde setup just keeps crashing after it has run for a couple of seconds. If I try to run the setup from start/run and then enter c:\msde\software\MSDESetup\setup /settings c:\msde\software\MSDESetup\setup.ini it works just fine but if I call it...
0
2241
by: henning.friese | last post by:
Hello NG, I'm need to write some code which creates tiff files from various document types (doc, pdf, xls). I want to do this by ShellExecuting (via System.Diagnostics.Process) the doc-files with the "print"-verb. This works for me. However, I need to handle the case when a printing application doesnt't quit in a given timespan (for...
0
7194
by: Paul | last post by:
Hi, I'm trying to kick off the iiscnfg.vbs from a webservice to export a website's config to an xml file (And eventually populate other servers with the config). I initially tried this using the 1.1 framework, but discovered that when I used Process.Start() the user's credentials were not impersonated, it just kept using the asp.net's user,...
11
13348
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then the process starts as the specified user, but hangs in a suspended state. In fact, any executable will exhibit this problem; it is not specific to whoami.exe. This is with .NET 2.0, of course (1.1 does not support running a process as a...
0
6675
by: Kirk | last post by:
The following C# web service works fine until you uncomment the lines setting UserName and Password. Then, Process.Start throws an Access is Denied Exception. This is with .NET 2.0, of course (1.1 does not support running a process as a different user). I'm running everything on Windows Server 2003. I have impersonation enabled in my...
3
24193
by: Rob | last post by:
I have an app that calls an eternal EXE using process.start. My issue is I have a couple command line parameters that need to be put in, so that it would read: Process p = new Process(); p.EnableRaisingEvents = false; p.StartInfo.WorkingDirectory = "C:\\AutoPM\\AutoD\\"; //**TESTING p.StartInfo.CreateNoWindow = false;...
10
6315
by: Stephany Young | last post by:
When one uses the System.Diagnostics.Process.Start method to launch a common or garden Console application, one can set the WindowStyle property of the StartInfo object to ProcessWindowStyle.Hidden so that the window for the Console application is not visible. However, when using some of the 'advanced' properties of the StartInfo object,...
0
7700
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7614
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
8125
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
1
7676
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
0
7974
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6284
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
0
3642
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2114
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
0
938
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.