Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Line length limit in xp batch file?

When running long command in .bat file (say 300 characters length)

for example:

Some_exe "C:/Documents and Settings/Some user/Some folder1/Some folder2/Some folder3/Some folder4 ... -Some_exe_arg1="arg 1 name" -Some_exe_arg2="arg 2 name" -Some_exe_arg3="arg 3 name"  

Is there a limit on the line size CMD.exe can process? Should i use .CMD or .BAT? Is there any way i can overcome this limitation?

Thank you!

like image 989
JavaSheriff Avatar asked Dec 17 '22 03:12

JavaSheriff


1 Answers

The minimum of the maximum batch line length is 8191 bytes!

This means that a line can be in any case 8191 bytes long, but it is also possible to create legal batch lines with nearly unlimited length.

Samples

echo Longline with 8191 characters.........

set "var=a"
echo UltraLongLine %var:4000chars=% %var:4000chars=% %var:4000chars=% %var:4000chars=%

echo Test <8000Chars <8000chars <8000chars .... <nul

The point is here, that all lines are less than 8192 bytes long after parsing

like image 116
jeb Avatar answered Feb 12 '23 12:02

jeb