views:

2498

answers:

8

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...?

A: 

Why don't you try bashing F3? :)

Dan
I'm not sure why someone marked this down. This is the correct answer.
bruceatk
No it's not. The OP asked, "[...] I need to know a command-line statement to run in order to open the standard Windows 'Find Files/Folders' dialog". So "Bashing F3" is definitely not the correct answer.
Charles Roper
It's the most correct so far. His goal is to create a hotkey. F3 is a hotkey, so is Win + F. The second part of his question is tough to do.
bruceatk
Half an answer still isn't an answer, though. :)
Charles Roper
A: 

Try "Launchy". For windows and linux. Awesome util.

Dustin
A: 

If you need just a hotkey then use Win+f.

J.F. Sebastian
+3  A: 

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.

Charles Roper
+2  A: 

There is no way from command line to get Explorer to show the Search Files pane. But you can get over it with some VBScript.

Try this

'ExplorerFind.vbs
Dim objShell
Set objShell = WScript.CreateObject("Shell.Application")
objShell.FindFiles

And compile it with cscript /nologo ExplorerFind.vbs

Pascal Paradis
Got the trick from http://www.pcreview.co.uk/forums/thread-1468270.php too!
Pascal Paradis
brian
+1  A: 

from http://www.pcreview.co.uk/forums/thread-1468270.php

@echo off
echo CreateObject("Shell.Application").FindFiles >%temp%\myff.vbs
cscript.exe //Nologo %temp%\myff.vbs
del %temp%\myff.vbs
brian
I haven't tried this; it looks like it might actually accomplish what I want... except that it's not clear whether I'd be able to tell it "search under directory X" as it launched...
IQpierce
A: 

It's a little unclear whether the end-result you want is the open "find" dialog, or if you're just looking for a command-line way to search an arbitrary directory. If the latter there's FINDSTR (assuming you want to search the content of files and not their names):

http://stackoverflow.com/questions/87350/what-are-good-grep-tool-for-windows#87394

Ben Dunlap
+3  A: 

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.

bruceatk
Fantastic. I had no idea you could save searches, and I'm amazed that XP doesn't even allow you to launch this from the command line.But this method allows me to do what I want (which, to clarify, was be able to quickly launch a dialog for searching my c:\dev\src directory with a hotkey any time).
IQpierce
You gotta love context sensitive menus which give you no clue as to what is possible, unless you already know the answer. :)
bruceatk