views:

34

answers:

1

I have a batch file, 'buildAll.bat', that builds a set of projects. It will be called by another batch file, 'manager.bat'. The 'buildAll.bat' job executes in another window and outputs a lot of text. I want the progress of the build job to be displayed in the original window('manager.bat'), like this:

Building project 1...done. Building project 2...done. Building project 3...done. ... Build completed.

How can the build progress be communicated between the two jobs ?

A: 

Temporary files, for example.

buildAll.cmd

del /Q %TEMP%\Project*Done>nul 2>&1
...
rem build project 1
copy nul %TEMP%\Project1Done >nul
rem build project 2
copy nul %TEMP%\Project2Done >nul
...

manager.cmd

...
<nul set /p X=Building project 1 ... 
:waitforproject1
if exists %TEMP%\Project1Done goto project1done
ping -n 1 localhost >nul 2>&1
goto waitforproject1
:project1done
echo done.

<nul set /p X=Building project 2 ... 
:waitforproject2
if exists %TEMP%\Project2Done goto project2done
ping -n 1 localhost >nul 2>&1
goto waitforproject2
:project2done
echo done.
...

Of course, this can be made much more powerful by relaying information about what projects are built and so on to the manager. But in principle it's easily possible.

Joey