Set MS-DOS 6.22 Temp Directory in AUTOEXEC.BAT
This article explains how to configure the temporary storage
directory in MS-DOS 6.22 using the AUTOEXEC.BAT startup
file. It covers the specific environment variables required, how to add
them to the configuration, and standard practices for ensuring operating
system utilities and third-party software have designated working space
for temporary files.
In MS-DOS 6.22, the temporary storage directory is defined using the
SET TEMP and SET TMP environment variable
commands inside the AUTOEXEC.BAT file. While MS-DOS
utilities primarily look for TEMP, many third-party
programs and compilers look for TMP. Because of this, it is
standard practice to define both variables to point to the exact same
folder.
The Required Configuration Lines
To set the temporary directory, add the following lines to your
AUTOEXEC.BAT file:
SET TEMP=C:\TEMP
SET TMP=C:\TEMPIf you prefer to place the directory inside the DOS directory, you
can specify C:\DOS\TEMP instead.
Steps to Configure the Directory
- Create the Directory: MS-DOS will not automatically
create the temporary folder if it does not exist. Create it at the
command prompt by typing:
MD C:\TEMP - Edit AUTOEXEC.BAT: Open the startup file using the
MS-DOS Editor:
EDIT C:\AUTOEXEC.BAT - Add the Commands: Place
SET TEMP=C:\TEMPandSET TMP=C:\TEMPon their own lines, typically near the top of the file alongside otherSETcommands (such asPATH). - Save and Exit: Press
Alt + F, select Save, and then exit the editor. - Apply Changes: Restart your computer or run
C:\AUTOEXEC.BATdirectly from the command prompt to load the new environment variables into memory.
Using a RAM Drive for Faster Performance
In MS-DOS 6.22, temporary file operations can be significantly
accelerated by redirecting the temporary path to a virtual RAM drive
created with RAMDRIVE.SYS in CONFIG.SYS.
If RAMDRIVE.SYS assigns drive letter D: to
your RAM disk, you can set the temporary variables in
AUTOEXEC.BAT as follows:
MD D:\TEMP
SET TEMP=D:\TEMP
SET TMP=D:\TEMPThis configuration prevents unnecessary disk read/write cycles on physical drives and speeds up utilities like MS-DOS Editor, defragmentation tools, and file archivers.