Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Wanet Telecoms Ltd on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Advance determine shell process termination.

Status
Not open for further replies.

MrSatan

Programmer
Jul 16, 2002
25
AU
Hi All,

I know by using some API functions, we are able to determine when a shelled process has terminated, but this only work for the first level call.

eg: Shell MyProgram.bat

Is there a way to determine the subsequent call as well.

eg: In MyProgram.bat, I am calling MyLongProgram.bat, so when I use Shell MyProgram.bat in VB, the shell process will terminate before the MyLongProgram.bat has finished.

Hope I am not asking for too much...;-)
 
I would try to handle the matter in the .bat-files... For example if you are working under Windows NT there is the cmd-function you can use to prevent termination of the first .bat before the second one terminates:

t1.bat
Code:
echo Start
cmd /Kt2
echo End

t2.bat
Code:
time
exit

Be aware of the exit-statement, it's needed to terminate the second "instance" of command-interpreter.

hope this helps
Andreas
 
windows does not maintain any links between programs. Once a program is launched it is independent (in most cases) from the caller. So for you to know when the "Tree" of apps are all closed you'd have to know the tree before hand as there really is no tree.

Wayne Francis
"There is no spoon"
 
I think SemperFi has the right of it.

In your batch files you can generally use a prefix of

START /W
which runs the step and waits for completion, 9x/me at least.

If that does not work you are left with semaphore files, where a step alerts others that it has completed by creating a zero length (usually) file.
 
Since I am dealing with batch files and am running under Windows 2000, so Andreas's method is the one I am after...:)

Thank you very much.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top