"Input line is too long" error in BAT File

I have had this same problem when executing a build script in a cmd window. After about 13 times I got that same error. The build script had to make sure that vcvarsall.bat was run so it executed vcvarsall.bat every time.

vcvarsall.bat is not smart enough to only add things to the path if they are not already there so a bunch of duplicate entries were added.

My solution was to add an if defined check on an environment variable which I know is set by vcvarsall.bat...

if not defined DevEnvDir (
    call vcvarsall.bat
)

Check your path environment variable after each run and see if it is growing. If it is and there are duplicates, you will need to be smart about adding stuff to the path. There are several ways to be smart about it.


I happened upon this error just now for the first time after running the same set of commands (stop / start an application server) a number of times.

The error stopped when I opened up a new command line and tried the commands from the new command line console.


This usually happens due to long path. I have resolved this issue by replacing base path of Kafka from C:\Program Files<Kafka_path> to C:\Kafka


I realize this is pretty old, but the other issue I ran into was having a " at the end of the command I was calling. I was attempting to call:

"C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools\..\IDE\CommonExtensions\Microsoft\TestWindow\vstest.console.exe""

If you notice, I have two " at the end of the line. This was causing my issues (Notepad++ included it when I typed the quotes). Removed that, all good. Again, may not be your issue, but if anyone else comes seeking info and nothing else works, check this. :)