How to find a file in MS-DOS

Windows command line (DOS)With MS-DOS it is possible to find any file on your computer, providing you know the name of the file or the program that the file was created in.

If you are unsure where the file may be on the computer, you must be at the root directory of the computer. Meaning, you must be at C:\> to get to this prompt, type cd\

Once at the root directory or the directory you believe the file to be in, type any of the below commands.

If, for example, you knew that the file had bob somewhere in the file you would type:

dir *bob*.* /s

In the above example you will utilize the wild character, which in MS-DOS is the asterisks ( * ). In addition to the asterisks, we utilize the /s that tells the dir command to search the current directory and all directories thereafter.

If you cannot recall any of the names of the files but recall that they were created in Microsoft Excel you could, for example, type:

dir *.xls /s

In the above example, knowing that Excel files always end with .xls, we again use the wild character, telling the computer to search for any file ending with .xls. If you do not know what the extension of your file is, you can find a listing of the majority of extensions and the associated program on our MS-DOS Extension page.

Finally, once you have found the file, you must interpret the output of your search and be able to then change directories to get to that file. Below is an example of the results found when typing dir *bob*.* /s as mentioned in an earlier example.

Volume in drive C has no label
Volume Serial Number is 214B-1DE8

Directory of C:\Computer Hope\Info\Files

GENMSBOB HTM 2,592 12-19-96 7:01p genmsbob.htm
1 file(s) 2,592 bytes

Directory of C:\Games\chessmaster\Personalities

BOBO CMX 2,584 09-10-99 1:00a BoBo.CMX
1 file(s) 2,584 bytes

Directory of C:\Games\Quake 2\baseq2\players1\Morbo

MORBOB~1 PCX 25,798 01-09-98 4:24a morboBASE.pcx
1 file(s) 25,798 bytes

Directory of C:\Windows MYBOB TXT 4 11-19-00 3:23p mybob.txt
1 file(s) 4 bytes

Total files listed:
4 file(s) 30,978 bytes
1 dir(s) 29,500.53 MB free

As you can see in the above example, several files were found that contain bob. If you receive more than expected results, you may need to type /p after the command. Using /p displays the results one page at a time. If, for example, the file we were looking for was mybob.txt, looking above, we see that this file is in the Directory of C:\Windows