Timing conflict in a x32Win10ProV22H2 batch file

Started by Sebastian42, April 21, 2024, 12:10:20 AM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Sebastian42

I will present two versions of a batch file, and list the effects they have.

Start "" "C:\Program Files\ToggleTaskbarAutohide\ToggleTaskbarAutohide.exe"
timeout 1
Start "" "C:\Program Files\Macro Express Pro 6\MeProc.exe" /ASaveDeskTopView
timeout 1
Start "" "C:\Program Files\ToggleTaskbarAutohide\ToggleTaskbarAutohide.exe"

The third 'START' line takes effect before the second one has completed 


Start "" "C:\Program Files\ToggleTaskbarAutohide\ToggleTaskbarAutohide.exe"
timeout 1
Start "" "C:\Program Files\Macro Express Pro 6\MeProc.exe" /ASaveDeskTopView
timeout 2
Start "" "C:\Program Files\ToggleTaskbarAutohide\ToggleTaskbarAutohide.exe"

When the second timeout is increased to anything over '1', the CMD window for the third 'START' line is superimposed on the snip image (thus spoiling it).

How to get the third 'Start' line to 'wait' till the second has completed ?

Sebastian42

It turns out that running the batch minimized using Task Scheduler solves the problem.

DaveLembke

Interesting...

I would have thought that adding a time delay in the batch would be the cure actually either using the SLEEP command following the prior service to fully start before moving onto the next START instruction or if SLEEP isn't available the ping 127.0.0.1 -n 15 instruction ( to make a time delay in pinging home for 15 iterations ), as time delays can avoid race conditions. The value of 15 can be any value of choice 1 or greater to make a short delay or longer delay before starting the next START instruction.