Deleting Temporary Files Created by MS-DOS Shell (49849)

The information in this article applies to:
    Microsoft MS-DOS operating system 4.0
    Microsoft MS-DOS operating system 4.01
    Microsoft MS-DOS operating system 5.0

This article was previously published under Q49849


The Microsoft MS-DOS Shell's File System creates a temporary file when a program is run while viewing the directory tree. This file is created to hold the current directory information so that the MS-DOS Shell does not have to search the drive again when the program exits. Upon return to the MS-DOS Shell's File System, the file is retrieved to the MS-DOS Shell's memory, and the file is deleted.

If the computer is rebooted before returning to the MS-DOS Shell, this temporary file is not deleted. The MS-DOS Shell cannot detect and delete this file the next time DOSSHELL is run. Thus, these temporary files build up on the disk whenever a File Run from the MS-DOS Shell File System is not exited properly.


To produce the temporary file and verify that it is deleted when you return to the MS-DOS Shell, perform the following steps:
    Invoke the MS-DOS Shell by typing the following command at the MS-DOS command line prompt:


    Run COMMAND.COM from the MS-DOS Shell File System.
    List the subdirectory from which the MS-DOS Shell was started. If DOSSHELL.BAT is in the path, this is the subdirectory that you were in when you started the MS-DOS Shell.
    Remember the name of the file that has no extension and a jumble of seemingly random letters for the filename.
    Exit COMMAND.COM by typing EXIT at the MS-DOS command-line prompt, as in the following example:

    C:\> EXIT

    Press the ENTER key at the "Return to Dos Shell" prompt. If the computer is rebooted instead of pressing the ENTER key at this point, the temporary file is not deleted.
    Using the File System, select the subdirectory that the MS-DOS Shell was started from to verify that the temporary file has been deleted.
The MS-DOS Shell's File System uses MS-DOS Interrupt 21H Function 5AH (Create Temporary File) to create its temporary file. Since this filename is a function of the current time and date, the MS-DOS Shell never uses the same filename for its temporary file. If these temporary files are not deleted (e.g., a program fails to properly exit back to the MS-DOS Shell), the temporary files collect on the disk, requiring manual deletion.

Modification Type: Major Last Reviewed: 10/14/2003
Keywords: KB49849