H
Hennie Jalink
We use a construction with redirect stdout to logfiles for
batchjobs. When doing this in two stages, using START
(nowait) the first logfile is (probably?) blocked by the
(asynchronous) process just STARTed.
It's a bit complicated, so I've created a testsituation.
Place the following files in one dir, CD to that dir, and
CALL T1.cmd.
T1.cmd
======
@echo OFF
echo =T1 PRE 1> T1.log
call T2.cmd 1>>T1.log
echo =T1 POST 1>>T1.log
T2.cmd
======
@echo OFF
echo =T2 PRE
START /wait T3.cmd
echo =T2 POST
T3.cmd
======
@echo OFF
echo =T3 PRE 1> T3.log
call T4.cmd 1>>T3.log
echo =T3 POST 1>>T3.log
exit
T4.cmd
======
@echo OFF
echo =T4 PRE: hit any key to go on!
PAUSE
echo =T4 POST
There is NO problem when START /wait is used in T2.cmd:
when you <enter> in CMD-box for T4 to lift the PAUSE, both
logfiles T1.log and T3.log reflect exactly what's
happening.
When using START without /wait, you see the following error
in the first CMD-box:
E:\Batch\TestProbleem>call t1.cmd
The process cannot access the file because it is being
used by another process.
In T1.log we miss the line "T1 POST", though "T2 POST" has
been written!
Can anyone help?
batchjobs. When doing this in two stages, using START
(nowait) the first logfile is (probably?) blocked by the
(asynchronous) process just STARTed.
It's a bit complicated, so I've created a testsituation.
Place the following files in one dir, CD to that dir, and
CALL T1.cmd.
T1.cmd
======
@echo OFF
echo =T1 PRE 1> T1.log
call T2.cmd 1>>T1.log
echo =T1 POST 1>>T1.log
T2.cmd
======
@echo OFF
echo =T2 PRE
START /wait T3.cmd
echo =T2 POST
T3.cmd
======
@echo OFF
echo =T3 PRE 1> T3.log
call T4.cmd 1>>T3.log
echo =T3 POST 1>>T3.log
exit
T4.cmd
======
@echo OFF
echo =T4 PRE: hit any key to go on!
PAUSE
echo =T4 POST
There is NO problem when START /wait is used in T2.cmd:
when you <enter> in CMD-box for T4 to lift the PAUSE, both
logfiles T1.log and T3.log reflect exactly what's
happening.
When using START without /wait, you see the following error
in the first CMD-box:
E:\Batch\TestProbleem>call t1.cmd
The process cannot access the file because it is being
used by another process.
In T1.log we miss the line "T1 POST", though "T2 POST" has
been written!
Can anyone help?