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

Article translations Article translations
Article ID: 69563 - View products that this article applies to.
This article was previously published under Q69563
Expand all | Collapse all

On This Page


This article contains information on the maximum number of lines and line length allowed for batch files (including the AUTOEXEC.BAT file) and the CONFIG.SYS file.


Batch Files

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

Each batch file line does have a limit, however. Any batch file line exceeding 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) limit on 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 device driver) loaded properly. There do appear to be some problems on the boundary condition when the CONFIG.SYS file size reaches 65,535 bytes.

Each CONFIG.SYS line does not appear to have a limit. The device driver INIT code is given a pointer to a read-only buffer, which contains the remainder of the CONFIG.SYS file, not just the command line. With this pointer, you can access a command line of any length.


Article ID: 69563 - Last Review: May 12, 2003 - 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
Retired KB Content Disclaimer
This article was written about products for which Microsoft no longer offers support. Therefore, this article is offered "as is" and will no longer be updated.

Give Feedback


Contact us for more help

Contact us for more help
Connect with Answer Desk for expert help.
Get more support from