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

允我心安 提交于 2019-12-05 01:13:01

问题


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


回答1:


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



回答2:


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.




回答3:


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.




回答4:


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




回答5:


just execute this line! (WinKey+R, CmdPrompt, Shortcut, ShellExecute, WinExec, etc)

search-ms:query=New%20Folder&

Find all shortcuts in your desktop

search-ms:query=*.lnk&crumb=folder:%userprofile%\Desktop&

Find the text "exe" in the folder "C:\Program Files"

search-ms:query=exe&crumb=location:C:\Program Files&

Other exemples

search-ms:query=microsoft&
search-ms:query=vacation&subquery=mydepartment.search-ms&
search-ms:query=seattle&crumb=kind:pics& 
search-ms:query=seattle&crumb=folder:C:\MyFolder&

reference here http://msdn.microsoft.com/en-us/library/ff684385.aspx




回答6:


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




回答7:


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




回答8:


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):

What are good grep tools for Windows?




回答9:


Addition to Ben Dunlap's answer: You could also use FINDSTR on the output of the DIR command (for instance in a FOR loop) This would search for filenames, not in files.




回答10:


Based on the answer by Vitim.us from cmd all you need is explorer.exe "search-ms:query=*.exe&crumb=location:C:\Program Files&" Change the location and query as needed




回答11:


Why don't you try bashing F3? :)



来源:https://stackoverflow.com/questions/95432/how-do-i-open-find-files-dialog-from-command-line-in-windows-xp-to-search-a-sp

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!