JSI Tip 4872. When you run MS-DOS applications, all MS-DOS environment variables are restricted to 128 characters?

Jerold Schulman

February 21, 2002

1 Min Read
ITPro Today logo in a gray background | ITPro Today

The MS-DOS sub-system uses COMMAND.COM, which has a 128 character input buffer.

Actually, the maximum variable length is 127 characters, as the end-of-variable character takes 1byte.

This limits the PATH environment variable to 122 characters, as PATH= uses 5 characters.

To work around this limit, you can do any of the following:

1. Use short folder names. 

2. Use batch files that modify the PATH based on the application.

3. Use batch files that use fully qualified names.

4. If you have only one partition, eliminate the drive letter from the path.

5. Use the subst command to create drive letters for long path strings.


Sign up for the ITPro Today newsletter
Stay on top of the IT universe with commentary, news analysis, how-to's, and tips delivered to your inbox daily.

You May Also Like