Page 1 of 1

how make one batch wait till the other batch finishes producing files

Posted: 28 Sep 2022 19:57
by nnnmmm

Code: Select all

BB.BAT has this

CALL "!emulator - setup.bat"
CALL "AAA.BAT"
if what i know is kind of true.....
if AAA.BAT runs before "!emulator - setup.bat" finishes producing the files that AAA.BAT needs, it causes an error, and the errors happen a lot
how do i make AAA.BAT wait till "!emulator - setup.bat" finishes

my fiddling options are
@EXIT /B : although i dont know how to use it clearly
@EXIT
start /wait
timeout T/1 : takes long for my taste, but i can accept it, but XP can not run timeout command but i will take it for win10 for now.

CALL "!emulator - setup.bat"
pause
CALL "AAA.BAT"
using PAUSE is unacceptable, but using pause never failed me

purpose : XP needs to delete all emulators and Win10 needs one in the same directory

Re: how make one batch wait till the other batch finishes producing files

Posted: 28 Sep 2022 23:48
by miskox
This code you have:

Code: Select all

CALL "!emulator - setup.bat"
CALL "AAA.BAT"
is OK. I would guess that your "!emulator - setup.bat" has a code that executes something that still runs when .bat completes. Maybe you could show us what your "!emulator - setup.bat" has?
If you generate output files (that are inpu files for your AAA.BAT) with only ECHO from .bat then I guess the problem is somewhere else.

Saso

Re: how make one batch wait till the other batch finishes producing files

Posted: 29 Sep 2022 00:13
by nnnmmm
!emulator - CnC for RA2 - Win10.exe
ddraw.dll
ddraw.ini
ddraw - config - cnc.exe

!emulator - dgVoodoo for NOLF1 - Win10.exe
D3D8.dll
D3D9.dll
D3DImm.dll
DDraw.dll
dgVoodoo.conf
dgVoodooCpl.exe

!emulator - nglide for hexen 2 - Win10.exe
glide.dll
glide2x.dll
glide3x.dll
nglide_config.exe

!emulator - wind3d for dune4 - Win10.exe
ddraw.dll
wined3d.dll

!emulator - CnC for RA2 - Win10.exe is a ZIP file (but not compressed at all, compression level is 0 that is -LEV=0)

Code: Select all

the actual setup of !emulator - setup.bat has

@ECHO OFF
SET P1=!emulator - wined3d for dune 4 - Win10.exe

REM ------------------------------------------------
IF NOT "%OS%"=="Windows_NT" GOTO :Win98

IF DEFINED PUBLIC GOTO :Win10
   call !emulator - delete.bat
GOTO :END

:Win10
   START "" "%P1%" -OVERWRITE
GOTO :END

:Win98
GOTO :END
REM ------------------------------------------------
:END
rem @EXIT /B

Re: how make one batch wait till the other batch finishes producing files

Posted: 29 Sep 2022 01:20
by miskox
Quick look: after

Code: Select all

START
add /WAIT so yu get:

Code: Select all

START /WAIT ...
One more thing: add double quote (") to your file names:

Code: Select all

IF DEFINED PUBLIC GOTO :Win10
   call "!emulator - delete.bat"
GOTO :END
Saso

Re: how make one batch wait till the other batch finishes producing files

Posted: 29 Sep 2022 03:36
by nnnmmm
CALL "!emulator - setup.bat"
pause or timeout /T 1
CALL "AAA.BAT"

ok, not this way to manipulate between two batches but actually to put start /wait in the "!emulator - setup.bat" as below
START /WAIT "" "%P1%" -OVERWRITE

1st trial caused an error, but not anymore thereafter on all other games, but i need to try more to say it for sure that it works after the PC loses the emulator's cache or trying agian from a long away from using last PC

my XP PC has been broken for 8 months, the motherboard seemed dead. I cant try XP's commands for a while

Re: how make one batch wait till the other batch finishes producing files

Posted: 29 Sep 2022 06:25
by miskox
Yes. Your bb.bat remains the same:

Code: Select all

CALL "!emulator - setup.bat"
CALL "AAA.BAT"
and in your

!emulator - setup.bat

change

Code: Select all

START "" "%P1%" -OVERWRITE
with

Code: Select all

START /WAIT "" "%P1%" -OVERWRITE
Because you are running .exe file you could probably do this:

Code: Select all

"%P1%" -OVERWRITE
This change works on XP too.

Saso

Re: how make one batch wait till the other batch finishes producing files

Posted: 29 Sep 2022 07:31
by nnnmmm
START /WAIT "" "%P1%" -OVERWRITE confirmed
so far, i only had 1 error doing this (1 error out of 20 experimental trials), it seemed much better, i still need to repeat this for many days when i start a pc and after it loses cache and for random time and situation and whatnot.
thanks for your help, this seems to do well.

Code: Select all

"%P1%" -OVERWRITE
i forgot about this, at some point of windows, without using START or START "", it didnt run many particular programs at times, something about the win title has to be given before running.
and i also forgot START had something to do with making the synchronious into the asynchronious, it became a habit of putting start "" in front of every program.

Re: how make one batch wait till the other batch finishes producing files

Posted: 01 Oct 2022 01:01
by nnnmmm
START /WAIT worked well and confirmed, i tested for several days for many, i didnt have an error.