Computer Hope
Microsoft => Microsoft DOS => Topic started by: nigelben on March 06, 2009, 10:33:03 AM
-
I have created a batch file with the following syntax
call c:\maxl\batch\inflation.bat
@echo off
:begin
febootimail -FROM [email protected] -TO [email protected] -MSG "Inflation Cubes are complete. Please do not respond to this message as it is sent from an unmonitored account." -SUBJECT "Inflation Cubes complete" -SMTP THCNOTES
if not errorlevel 5 goto end
echo Couldn't connect to server. Trying again...
goto begin
:end
echo End of batch program.
the first line calls another batch file which runs an essbase maxl script in a dos window, the problem is that when it runs the script it calls the 2nd batch file and that closes as soon as it has called the maxl script, I need a way to make the called batch file wait until the maxl script has run its course , is there anyway to make it wait until the script has run
-
If you know how long it takes for that process to complete you can use a number of ways to make it count x number of seconds before continuing.
Would a preset time delay work for you?
-
not really, I need to know the time it is complete and then an email sent, the process could take 30 minutes to an hour based on server usage
-
i tested the following code, and call statement does calling another batch, and return to the caller once finished.
@echo off
(
echo echo inflation bat start
echo ping 127.0.0.1 ^>nul
echo echo inflation bat finish
)>#.bat
call #.bat
echo return from call statement
so i suspect "inflation.bat" contain some command that run windows program in its own thread/process. or it might contain nt dos command such as "start","%comspec%", or "cmd" which create a new instance.
-
How about changing your CALL batch file command to:
start /wait cmd /C "c:\maxl\batch\inflation.bat"
-
@echo off
(
echo echo inflation bat start
echo ping 127.0.0.1 ^>nul
echo echo inflation bat finish
)>#.bat
call #.bat
echo return from call statement
this command is rewriting the inflation.bat file to read
echo echo inflation bat start
echo ping 127.0.0.1 ^>nul
echo echo inflation bat finish
-
this command is rewriting the inflation.bat file to read
??? ??? ???
it's just an example to proof that call statement does wait for a batch file to finish executing before returning.
if you can post the code of inflation.bat, maybe someone can help you.
-
I think the code in Reply #4 should work for any code in the "inflation.bat" file.