DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: IDEA : program which waits will specified programs complete  (Read 6,149 times)

sprint907

  • Participant
  • Joined in 2012
  • *
  • Posts: 11
IDEA : program which waits will specified programs complete
« on: December 27, 2012, 11:47 AM »
This is my requirement...
I am running many instances of xxcopy.exe in multiple command line windows.
I need to shutdown the PC after all the xxcopy.exe process completes.
I need a program which waits till all xxcopy.exe instances are completed

example :- i could write a batch file which has below contents
----------------------------
myprog.exe xxcopy.exe
shutdown -s
----------------------------
The program should wait and then execute the shutdown.


or if i have xxcopy.exe, java.exe, oracle.exe processing running, and I need to send an email after all three have completed...
----------------------------
myprog.exe xxcopy.exe java.exe oracle.exe
sendmail -to abc@yahoo.com -subject "complete"
----------------------------

Is such a program possible?

4wd

  • Pedantic Old Bastard
  • Supporting Member
  • Joined in 2006
  • **
  • Posts: 5,652
    • Coding Snacks
Re: IDEA : program which waits will specified programs complete
« Reply #1 on: December 27, 2012, 12:47 PM »
Try this:

WTPF.exe [prog1.exe] [prog2.exe] ........

If there's multiple processes with the same name, you only need to specify it once.

Code: (autoit)
#Region ;**** Directives created by AutoIt3Wrapper_GUI ****
#AutoIt3Wrapper_UseUpx=n
#AutoIt3Wrapper_Change2CUI=y
#EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****
;WaitTillProcessFinish (WTPF)

$process = False
If $CmdLine[0] = 0 Then Exit

Do
	For $i = 1 To $CmdLine[0]
		$list = ProcessList($CmdLine[$i])
		If $list[0][0] > 0 Then
			$process = True
			ExitLoop
		Else
			$process = False
		EndIf
	Next
	Send("^")
	Sleep(5000)
Until $process = False
"I will not follow where the path may lead, but I will go where there is no path, and I will leave a trail." - Muriel Strode, 1903
« Last Edit: January 28, 2013, 12:38 AM by 4wd »

sprint907

  • Participant
  • Joined in 2012
  • *
  • Posts: 11
Re: IDEA : program which waits will specified programs complete
« Reply #2 on: December 27, 2012, 02:45 PM »
hi 4wd,
This is what I wanted.
Thanks a lot.  Much appreciated.

Original address: https://www.donationcoder.com/forum/index.php?topic=33442.0