In Windows (base install) what is the fastest way to search only filenames?

1

In Windows (base install: no extensions, tools, add-on's, or 3rd Party software) what is the fastest native way to search only filenames AND without modifying the "state" of indexing and/or changing the "state" of content search?

The fastest way I know to do this is in [Windows Explorer] to enter in the search box >>>

System.FileName:~="SomePartOfTheFilenameHere"

... and because I'm a geek, I'll typically paste the following in the search box >>>

System.FileName:~=""

... and then type into the quotes. I've found that on older machines (especially on a directory with no indexing, but "search in contents ON") even just typing in the box has an impact until System.FileName: is fully typed out and causes the mice to spin, but by pasting it in it goes straight into "FileName Only" mode.

Does anyone know a faster / better way?

George 2.0 Hope

Posted 2014-08-05T20:05:40.317

Reputation: 288

Although I don't know for sure, powershell may have some trick up its sleeves. – tumchaaditya – 2014-08-05T20:11:52.157

C:\>dir /s /b "filen*.*" in a command prompt comes to mind. – LPChip – 2014-08-05T20:26:47.573

@tumchaaditya PowerShell (http://technet.microsoft.com/en-us/scriptcenter/powershell.aspx) afaik is not native/core and needs to be installed. If I'm correct, then in this case it would be excluded for the purposes of this question. Thanks though.

– George 2.0 Hope – 2014-08-05T21:51:19.443

1@GeoBaj PowerShell is bundled with Windows 7 and later, but has to manually installed in previous operating systems. – and31415 – 2014-08-06T08:33:28.963

Answers

0

Using the command-line interface

  1. While holding down the Shift key, right-click an empty spot in the folder you're in, and choose Open Command Window Here (this works in Windows Vista and later).

  2. Once the command prompt is open, type or paste the following command, and press Enter:

    dir *whatever* /a:-d
    

    The /a:-d parameter will omit directories from the results, thus performing a file-only search. If you want to include subfolders you can use the /s parameter:

    dir *whatever* /a:-d /s
    

    By default, the output is quite verbose and includes different information, such as file size or last modified time. To get a bare bones list stripping all extra information, use the /b parameter:

    dir *whatever* /a:-d /b /s
    

    You can also search multiple strings. Quotes are required if you use spaces:

    dir "*some thing*" *whatever* /a:-d /b /s
    

Further reading

and31415

Posted 2014-08-05T20:05:40.317

Reputation: 13 382

I recommend adding the /b switch so it only gives a path and filename as result rather than a full header for each folder. – LPChip – 2014-08-05T20:31:31.313

In a quick search for a file, you want to know its location, usually not when it was modified or how large it is. – LPChip – 2014-08-05T20:33:35.083