Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I open "Find Files" dialog from command-line in Windows XP to search a specific folder?

I'd like to create a hotkey to search for files under a specific folder in Windows XP; I'm using AutoHotkey to create this shortcut.

Problem is that I need to know a command-line statement to run in order to open the standard Windows "Find Files/Folders" dialog. I've googled for a while and haven't found any page indicating how to do this.

I'm assuming that if I know the command-line statement for bringing up this prompt, it will allow me to pass in a parameter for what folder I want to be searching under. I know you can do this by right-clicking on a folder in XP, so I assume there's some way I could do it on the command line...?

like image 302
IQpierce Avatar asked Dec 03 '22 16:12

IQpierce


2 Answers

Use Locate32

This isn't the exact answer to your question, but you could use Locate32 instead of the Windows search facility. It has a whole suite of command-line options plus has the huge benefit of being an indexed search, which means the results will display instantaneously. It's a tool I can't be without on Windows.

This is the command you would issue to search for all index.php files in D:\home:

locate32.exe -r -p D:\home index.php

where the -r switch makes Locate32 search immediately without user intervention (without it, the interface would launch and the fields would be populated, but you'd have to hit Enter to proceed with the search) and -p D:\home is the path to search.

Using AutoHotKey, it's simple to assign the above command to a keyboard shortcut.

There is also a fully command-line based version of Locate32 in the same package called locate.exe. This uses the same indexes as Locate32, but because it is completely CLI-based, can be used by scripting languages and other tools to take advantage of the blistering search performance it offers.

like image 96
Charles Roper Avatar answered Dec 30 '22 15:12

Charles Roper


F3 or Win+F is a hotkey that will launch Find Files. If you then do a search using the criteria you want, you can save the search using the File menu. This creates a .FND file. The FND file can be launched from the command line or from a hot key created with autohotkey.

It is possible to edit the .FND file (binary) and change what it is searching for, but I would avoid doing that unless it's the only way you can accomplish what you want. I tried it and it worked fine.

like image 28
bruceatk Avatar answered Dec 30 '22 16:12

bruceatk