Searching for a file in Windows Explorer takes forever, but there’s a faster way if you’re willing to use the command prompt.

The amazing Twitter account SwiftOnSecurity posted this gem yesterday:

You can use this trick to search any drive and will usually finish in a few seconds. In the screenshot above, for example, I searched my drive for all files that include “justinpot” in the name by running dir \*justinpot* /s. Swift, in the tweet, searched for all log files on a drive by running dir \*.log /s.

Confused? Let’s break this down:

  • dir is a command used to show files in the current directory, but which can also show files anywhere in the system.
  • The backslash tells dir to search from the root directory of the current drive.
  • /s tells dir to search all subdirectories.
  • Finally, * is used by command line apps as a wildcard. So *.txt will show you all files that end with “.txt”, while project* will show you all filenames that begin with the word “project”

Put it all together and you’ve got a quick way to search any drive pretty quickly. Give it a try, but note that this won’t work in PowerShell.

Profile Photo for Justin Pot Justin Pot
Justin Pot has been writing about technology for over a decade, with work appearing in Digital Trends, The Next Web, Lifehacker, MakeUseOf, and the Zapier Blog. He also runs the Hillsboro Signal, a volunteer-driven local news outlet he founded.
Read Full Bio »