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.

Justin Pot is the News Editor for How-To Geek. He lives in Hillsboro, Oregon. Follow him on Twitter and Facebook, if you want. You don’t have to.



Please enter your comment!
Please enter your name here