Hi, I'm running 64b Win7. I have a batch file (.bat) that I use to shut the machine down each night, that optionally backs up data and then which calls CCleaner. After CCleaner finishes the system shuts down.
Everything works fine. But here's what I want to do. I want to start another program when the script opens, have it run in parallel to the backup and cleaning operation, and have its completion mutually critical, with the backup/cleaning operations, to the machine shutting down.
IOW, I want to parallel process, but I want the final shut down to be dependent on both processes completing. I don't want the system to shut down until both are finished.
Currently I call the first program via a Start command. The problem is that the machine shuts down when the cleaning process is done, regardless of whether the first program is finished.
It's a logical problem that I haven't been able to find a batch tool to solve yet. My other option might be to go to an autoit script.
Thanks,
p.
I think if you create a loop that monitors activity it should work...
for example, the shutdown script would monitor if the other BATs are still running...if not then it would engage shutdown.
Okay, this sounds good. So far I've got this: tasklist /FI "IMAGENAME eq autoit3_x64.exe" 2>NUL | find /I /N "autoit3_x64.exe">NUL
if "%ERRORLEVEL%"=="0" echo Programm is running(Courtesy of: Chaosmaster )
Now I need find how to set up a loop that tests periodically, and I should be home.
Thanks much,
p.
Here's the gist of what I worked up. Working fine on Win7: @echo off
::parallel process
Start "" notepad::trunk process
"c:\users\paul\desktop\us time zone map.gif":EXITTESTS
:: test for parallel process to die before launching 3rd processecho testing...
tasklist /FI "IMAGENAME eq notepad.exe" 2>NUL | find /I /N "notepad.exe">NUL
if "%ERRORLEVEL%"=="0" goto WAIT:final phase
echo 3rd process
C:\utilities\CCleaner\CCleaner.exe
goto EOF:WAIT
echo waiting...
timeout /t 5 /nobreak > NUL
goto EXITTESTS:EOF
This is a test reply to check notifications. Sorry for the bump.
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |