Searching files by file extension using command prompt in Windows

What it does

This search will display all the files with that extension in the specified directory as well as all the subdirectories under that. It lists the documents by file path and can be useful in locating documents when backing up files using command prompt.


This command should work on:

§  All versions of MS-DOS

§  Windows 95

§  Windows 98

§  Windows ME

§  Windows NT

§  Windows 2000

§  Windows XP

§  Windows Vista

§  Windows 7


1.      Find the drive that the files are located on and specify that drive in command prompt.

a.      Command - [Drive Name:]

b.      Example - C:

2.      The search can be done at this point if you want to search through the full drive but note that it will be a quicker search if you narrow down the file path.

a.      Command - dir/s *[file extension]

b.      Ex: dir/s *.doc

c.      Note: There is a space between the dir/s and *.doc

3.      To narrow down the search, you can specify the path by using the cd command and then search for the files using the search command listed on #2.

a.      Example:


C:\>cd users

C:\Users>dir/s *.doc