1.

Solve : how to wait a a command finish in bat ???

Answer»

Hi all!!

in a bat file that contains, i.e.:

call batch1.bat
call batch2.bat

how to prevent batch2.bat's execution if the batch1.bat is not finished

there is a way to return parameter from a bat file? i.e. the batch1.bat can return some parameter to bat caller after its execution ?

I need to run some rotines in batch1.bat but JUST these COMMANDS is finished that batch2 must start...

some hint ??

thanx

hwoarangcall batch1.bat
Pause
call batch2.bat

That will run batch1.bat  then pause promptimg your user to press any key to continue, the it will run BATCH 2.

Give me a little more detail wht you want your batch file to do and I can help.Have batch1.bat create a flag file (i.e. C:\temp\batch1.err) when it does not complete. Then check for the existence of that file before running batch2.bat.  Make sure batch1.bat insures the flag file does not exist when it starts, if so delete it.Ok, it should look something like this but I don't know how to actually get this task ACCOMPLISHED:


BATCH1.BAT
---------------
echo off
if exist C:\Temp\batch1.err del C:\Temp\batch1.err
:START
set okay=y
(whatever commands you want executed here)
(somehow have it set the %okay% variable to n if the command dosen't execute properly)
if okay=n goto NOPE
goto END
:NOPE
echo off>>C:\Temp\batch1.err
:END
call BATCH2.BAT


BATCH2.BAT
---------------
echo off
if exist C:\Temp\batch1.err goto NO
:START
(whatever commands you want executed here)
goto END
:NO
echo.
echo Error in BATCH1.BAT!
echo.
PAUSE
:END


I don't know, maybe have it somehow make ANOTHER temporary file as a flag, check if it exists then delete it.

Very complicated.



Discussion

No Comment Found