How to find a file or folder in MS-DOS or Windows command line
You can find any file on your computer using MS-DOS providing you know the name of the file or the program that created the file.
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 the below command.
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 wildcard, which in MS-DOS is the asterisks ( * ). Also, we utilize the /s command switch to tell the dir command to search the current directory and all sub directories.
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 typically end with the .xls file extension, 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 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 C:\Windows directory.