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



The information in this article applies to:
    Microsoft MS-DOS operating system 3.1
    Microsoft MS-DOS operating system 3.2
    Microsoft MS-DOS operating system 3.21
    Microsoft MS-DOS operating system 3.3
    Microsoft MS-DOS operating system 3.3a
    Microsoft MS-DOS operating system 4.0
    Microsoft MS-DOS operating system 4.01
    Microsoft MS-DOS operating system 5.0
    Microsoft MS-DOS operating system 5.0a
    Microsoft MS-DOS operating system 6.0
    Microsoft MS-DOS operating system 6.2
    Microsoft MS-DOS operating system 6.21
    Microsoft MS-DOS operating system 6.22

This article was previously published under Q69563

SUMMARY

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.

MORE INFORMATION

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.

CONFIG.SYS File

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.

Modification Type: Major Last Reviewed: 5/12/2003
Keywords: KB69563