How can I launch batch files from another batch file while piping their output and retaining the current working directory?

Solution 1:

This should do what you're asking for:

cmd /c clearwebtemp.bat > clearwebtemp_out.txt
cmd /c clearblahtemp.bat > clearblahtemp_out.txt
cmd /c clearblihtemp.bat > clearblihtemp_out.txt

Solution 2:

Another Solution:

@ECHO OFF
pushd .
call clearwebtemp.bat > clearwebtemp_out.txt
popd
pushd .
call clearblahtemp.bat > clearblahtemp_out.txt
popd
pushd .
call clearblihtemp.bat > clearblihtemp_out.txt

or

@ECHO OFF
call clearwebtemp.bat > clearwebtemp_out.txt
%~d0
cd %~p0
call clearblahtemp.bat > clearblahtemp_out.txt
%~d0
cd %~p0
call clearblihtemp.bat > clearblihtemp_out.txt

You can ignore the %~d0 if your bats :) stay on the same drive.