Maximum Line Length and Count for Batch Files & CONFIG.SYS

This article was previously published under Q69563
This article has been archived. It is offered "as is" and will no longer be updated.
This article contains information on the maximum number of lines and linelength allowed for batch files (including the AUTOEXEC.BAT file) and theCONFIG.SYS file.

Batch Files

There is no apparent limit. A test batch file with 67,000 lines and a totalof 804,000 bytes ran all the way through (but it took 15 minutes to do soon a 386/33 machine). COMMAND.COM reads one batch line at a time, and onlyretains a file pointer for the batch file, so it does not require a largebuffer to hold batch file commands before processing them. This shouldallow for batch files that span an entire disk, if so desired.

Each batch file line does have a limit, however. Any batch file lineexceeding 127 bytes is truncated at 127 bytes before it is processed.


There is no limit on lines, but there is a 64-kilobyte (65,534 byte) limiton the overall file size. A test with a CONFIG.SYS that contained only 76-byte long REM statements (except for the last line, which loaded a devicedriver) loaded properly. There do appear to be some problems on theboundary condition when the CONFIG.SYS file size reaches 65,535 bytes.

Each CONFIG.SYS line does not appear to have a limit. The device driverINIT code is given a pointer to a read-only buffer, which contains theremainder of the CONFIG.SYS file, not just the command line. With thispointer, you can access a command line of any length.
6.22 3.20 3.21 3.30 3.30a 4.00 4.01 5.00 5.00a 6.00 6.20

Article ID: 69563 - Last Review: 12/04/2015 09:06:33 - Revision: 2.0

Microsoft MS-DOS 3.1, Microsoft MS-DOS 3.2 Standard Edition, Microsoft MS-DOS 3.21 Standard Edition, Microsoft MS-DOS 3.3 Standard Edition, Microsoft MS-DOS 3.3a, Microsoft MS-DOS 4.0 Standard Edition, Microsoft MS-DOS 4.01 Standard Edition, Microsoft MS-DOS 5.0 Standard Edition, Microsoft MS-DOS 5.0a, Microsoft MS-DOS 6.0 Standard Edition, Microsoft MS-DOS 6.2 Standard Edition, Microsoft MS-DOS 6.21 Standard Edition, Microsoft MS-DOS 6.22 Standard Edition

  • kbnosurvey kbarchive KB69563