Timing Conflict In A X32win10prov22h2 Batch File

Discussion in 'Software' started by Sebastian42, Apr 25, 2024.

  1. Sebastian42

    Sebastian42 Private First Class

    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 ?

    Would it be possible to have the third line in a separate batch file which the first calls ? If so, how ?
     
  2. foogoo

    foogoo Major "foogoo" Geek

    @echo off

    REM Start your process here
    start /wait your_process.exe

    REM Loop to check if the process is still running
    :WAIT_LOOP
    tasklist | find "your_process.exe" > nul
    if %errorlevel% equ 0 (
    REM Process is still running, wait for a few seconds and check again
    timeout /t 5 /nobreak > nul
    goto WAIT_LOOP
    ) else (
    REM Process has finished, continue with the batch file
    echo Previous process has finished.
    REM Add your commands here
    )
     
  3. Sebastian42

    Sebastian42 Private First Class

    Simply preceding my code with yours, triggers "Windows cannot find 'your_process.exe'.", It is only when I intervene by closing that error message, that the process continues and gives the same results as without your code.
    So I would substitute for 'your_process' the fifth line of my original batch file, as there is a need to WAIT only at that stage.
    But that leaves me wondering what to substitute for 'Add your commands here'
     
  4. foogoo

    foogoo Major "foogoo" Geek

    replace "your_process.exe" with "MeProc.exe"
    This would be nestled between the first and third

    Start "" "C:\Program Files\ToggleTaskbarAutohide\ToggleTaskbarAutohide.exe"
    timeout 1
    Start "" "C:\Program Files\Macro Express Pro 6\MeProc.exe" /ASaveDeskTopView
    :WAIT_LOOP
    tasklist | find "MeProc.exe" > nul
    if %errorlevel% equ 0 (
    REM Process is still running, wait for a few seconds and check again
    timeout /t 2 /nobreak > nul
    goto WAIT_LOOP
    ) else (
    Start "" "C:\Program Files\ToggleTaskbarAutohide\ToggleTaskbarAutohide.exe"
    )

     
  5. Sebastian42

    Sebastian42 Private First Class

    I pasted your code into a batch file and ran it.
    The second toggle took effect before the snip happened.
     
  6. Sebastian42

    Sebastian42 Private First Class


MajorGeeks.Com Menu

Downloads All In One Tweaks \ Android \ Anti-Malware \ Anti-Virus \ Appearance \ Backup \ Browsers \ CD\DVD\Blu-Ray \ Covert Ops \ Drive Utilities \ Drivers \ Graphics \ Internet Tools \ Multimedia \ Networking \ Office Tools \ PC Games \ System Tools \ Mac/Apple/Ipad Downloads

Other News: Top Downloads \ News (Tech) \ Off Base (Other Websites News) \ Way Off Base (Offbeat Stories and Pics)

Social: Facebook \ YouTube \ Twitter \ Tumblr \ Pintrest \ RSS Feeds