Linear length limit in xp batch file?

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

eg:

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 line size limit that CMD.exe can handle? Should I use .CMD or .BAT? Is there a way to overcome this limitation?

Thanks!

+4
source share
2 answers

The minimum maximum row string length is 8191 bytes!

This means that the string can be 8191 bytes in any case, but it is also possible to create legitimate periodic strings with almost unlimited length.

Examples

 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 here is that all lines are less than 8192 bytes after parsing

+6
source

All versions of Windows with XP support a maximum packet line length of 8191 bytes: http://support.microsoft.com/kb/830473

Often executable files bypass the command line length limit by letting you specify parameter values ​​in the file. For example, FINDSTR has the / G: file name option, which indicates the name of the file containing the search strings.

There is no difference between .BAT vs .CMD with regard to string length. In fact, there is practically no difference between them: fooobar.com/questions/13336 / .... (Note: Most of the comments questioned about the accuracy of the linked answer precede the last edited version of the answer. The linked answer is now correct.)

+5
source

Source: https://habr.com/ru/post/1399899/


All Articles