I'm performing a mass build (1000+) projects. I call a batch file that calls another batch file that contains a long list of calls to project builds. The problems is, after a few projects, the process stops and says "The input line is too long". I did some research and found that the path environment vars are probably changing and therefore becoming too long. How can I reset the path variable between each of the build calls? Or is there another way I can solve this problem?
1 Answer
A simple solution is that in the batch file which modifies PATH or in one of the parent batch files you insert the line
set InitialPath=%PATH%
And later when the project is built another a line is inserted
PATH=%InitialPath%
A small batch file demonstrating this simple solution:
@echo off
rem Remember initial value of environment variable PATH.
set InitialPath=%PATH%
rem Environment variable PATH is modified to include a compiler directory.
PATH=C:\Program Files (x86)\MyCompiler\bin;%PATH%
rem Do here whatever must be done with modified PATH.
echo %PATH%
rem Restore the initial value of environment variable PATH.
PATH=%InitialPath%
echo %PATH%
rem Optionally the environment variable InitialPath is removed finally.
set InitialPath=