Home

How to Search for Files from the DOS Command Prompt

|
|  Updated:  
2021-11-02 18:01:03
PCs & Laptops For Dummies
Explore Book
Buy On Amazon
By opening a command prompt window, you can search for files that Windows truly doesn’t want you to know are there. It’s a little technical, but when you really, really need to find a file, the method described in the following steps does the job:
    1. From the Start menu, search for and open the Command Prompt.

    2. Type CD, a space, and then the backslash character.

CD /
  1. Press Enter. This command propels you to the root directory (folder) on the main hard drive.

  2. Type DIR and a space.

  3. Type the name of the file you’re looking for.

    For example, if you’re looking for the file secret.doc, type secret.doc. You can type upper- or lowercase letters.

    When you don’t know the full name, replace the part you don’t know with an asterisk (which is a wildcard). For example, you type secret* to search for all files beginning with the word secret.

    Don’t type any spaces. If you must type a space, use the ? (question mark) character instead.

  4. Type another space and then /S, a space, and /P.

    The complete command line to look for the file secret.doc appears like this:

    dir secret.doc /s /p

    The /s option directs a search of all folders on the hard drive; the /p option pauses the display after each screen of text. Double-check everything!

  5. Press the Enter key.

    The results display one screen at a time.

  6. Peruse the screen full of results.

  7. If you find a file that matches, you can open a Windows Explorer window to display the file’s folder.

    Press Win+E to open a Windows Explorer window.

    The pathname is found above the filename in the results. The pathname reads similar to this line:

    <span class="code">Directory of C:UsersDangDocumentsForgotten</span>
  8. If the file isn’t found, press Enter to see the next screen (if necessary).

    The prompt reads Press any key to continue, but the Enter key is the “any key.” Repeat Steps 7 and 8 to review the results.

  9. Type the EXIT command to close the Command Prompt window when you’re done.

Yes, this method is not only technical — it’s tedious. But the DIR command does a thorough job of scouring the entire hard drive. Sometimes you may want to use it just to confirm that a file doesn’t exist.

About This Article

This article is from the book: 

About the book author:

Dan Gookin has been writing about technology for 20 years. He has contributed articles to numerous high-tech magazines and written more than 90 books about personal computing technology, many of them accurate.
He combines his love of writing with his interest in technology to create books that are informative and entertaining, but not boring. Having sold more than 14 million titles translated into more than 30 languages, Dan can attest that his method of crafting computer tomes does seem to work.
Perhaps Dan’s most famous title is the original DOS For Dummies, published in 1991. It became the world’s fastest-selling computer book, at one time moving more copies per week than the New York Times number-one best seller (although, because it’s a reference book, it could not be listed on the NYT best seller list). That book spawned the entire line of For Dummies books, which remains a publishing phenomenon to this day.
Dan’s most recent titles include PCs For Dummies, 9th Edition; Buying a Computer For Dummies, 2005 Edition; Troubleshooting Your PC For Dummies; Dan Gookin’s Naked Windows XP; and Dan Gookin’s Naked Office. He publishes a free weekly computer newsletter, “Weekly Wambooli Salad,” and also maintains the vast and helpful Web site www.wambooli.com.