Detect inactive Bat file
-
Hi all i have the folloeing code to run a batch file System.Diagnostics.ProcessStartInfo psiinfo=new System.Diagnostics.ProcessStartInfo("aaa.bat"); psiinfo.WindowStyle=System.Diagnostics.ProcessWindowStyle.Hidden; psiinfo.CreateNoWindow=true; System.Diagnostics.Process p1=System.Diagnostics.Process.Start(psiinfo); while(!p1.HasExited); // //Following some other code // It works fine with Xp and 2000. But the problem comes with windows 98 in that after executing the batch file the batch file will not get closed . instead it will become an inactive window and the user has to close it manualy . So "has Exited " is not working here since the process is not getting closed. is there any way to find out whether the process in inactive or completed execution .. thanks in Advance AnnS Suffering cheerfully endured, ceases to be suffering and is transmuted into an ineffable joy.
-
Hi all i have the folloeing code to run a batch file System.Diagnostics.ProcessStartInfo psiinfo=new System.Diagnostics.ProcessStartInfo("aaa.bat"); psiinfo.WindowStyle=System.Diagnostics.ProcessWindowStyle.Hidden; psiinfo.CreateNoWindow=true; System.Diagnostics.Process p1=System.Diagnostics.Process.Start(psiinfo); while(!p1.HasExited); // //Following some other code // It works fine with Xp and 2000. But the problem comes with windows 98 in that after executing the batch file the batch file will not get closed . instead it will become an inactive window and the user has to close it manualy . So "has Exited " is not working here since the process is not getting closed. is there any way to find out whether the process in inactive or completed execution .. thanks in Advance AnnS Suffering cheerfully endured, ceases to be suffering and is transmuted into an ineffable joy.
Try giving other processes some CPU time as well: replace your while loop by: while(!p1.HasExited) Thread.Sleep(200); AFAIK older Windows such as Win98 are not as good in switching processes in time, so you should not choose a delay that is much smaller; your code was keeping the current process very busy, and I guess Win98 could not deal with that.
Luc Pattyn