Welcome guest. Before posting on our computer help forum, you must register. Click here it's easy and free.

Author Topic: Timing conflict in a x32Win10ProV22H2 batch file  (Read 1318 times)

0 Members and 1 Guest are viewing this topic.

Sebastian42

    Topic Starter


    Intermediate

    • Yes
  • Certifications: List
  • Experience: Experienced
  • OS: Windows 10
Timing conflict in a x32Win10ProV22H2 batch file
« on: April 21, 2024, 12:10:20 AM »
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

    Topic Starter


    Intermediate

    • Yes
  • Certifications: List
  • Experience: Experienced
  • OS: Windows 10
Re: Timing conflict in a x32Win10ProV22H2 batch file
« Reply #1 on: April 29, 2024, 12:14:26 AM »
It turns out that running the batch minimized using Task Scheduler solves the problem.

DaveLembke



    Sage
  • Thanked: 662
  • Certifications: List
  • Computer: Specs
  • Experience: Expert
  • OS: Windows 10
Re: Timing conflict in a x32Win10ProV22H2 batch file
« Reply #2 on: April 29, 2024, 03:15:12 PM »
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.