如何在Windows XP中从命令行打开“查找文件”对话框以搜索特定文件夹?

时间:2021-08-25 19:58:06

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.

我想创建一个热键来搜索Windows XP中特定文件夹下的文件;我正在使用AutoHotkey来创建此快捷方式。

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.

问题是我需要知道要运行的命令行语句才能打开标准Windows“查找文件/文件夹”对话框。我用Google搜索了一段时间,但没有找到任何指示如何执行此操作的页面。

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

我假设如果我知道用于提示此提示的命令行语句,它将允许我传入一个参数,用于我想要搜索的文件夹。我知道你可以通过在XP中右键单击一个文件夹来做到这一点,所以我假设有一些方法可以在命令行上做到这一点......?

11 个解决方案

#1


3  

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


5  

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.

这不是您问题的确切答案,但您可以使用Locate32而不是Windows搜索工具。它有一整套命令行选项,并且具有索引搜索的巨大优势,这意味着结果将立即显示。这是我在Windows上不能没有的工具。

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

这是您在D:\ home中搜索所有index.php文件时要发出的命令:

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.

-r开关在没有用户干预的情况下立即进行Locate32搜索(没有它,接口将启动并填充字段,但您必须按Enter键才能继续搜索)和-p D:\ home是搜索路径。

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

使用AutoHotKey,将上述命令分配给键盘快捷键很简单。

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.

在名为locate.exe的同一个包中还有一个完全基于命令行的Locate32版本。它使用与Locate32相同的索引,但由于它完全基于CLI,脚本语言和其他工具可以使用它来利用它提供的极快的搜索性能。

#3


4  

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.

F3或Win + F是一个将启动查找文件的热键。如果您随后使用所需的条件进行搜索,则可以使用“文件”菜单保存搜索。这会创建一个.FND文件。可以从命令行或使用autohotkey创建的热键启动FND文件。

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.

可以编辑.FND文件(二进制文件)并更改它所搜索的内容,但我会避免这样做,除非它是您完成所需内容的唯一方法。我试过了,它工作正常。

#4


3  

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.

从命令行无法让Explorer显示“搜索文件”窗格。但你可以用一些VBScript来克服它。

Try this

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

And compile it with cscript /nologo ExplorerFind.vbs

并使用cscript / nologo ExplorerFind.vbs编译它

#5


3  

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

只需执行此行! (WinKey + R,CmdPrompt,Shortcut,ShellExecute,WinExec等)

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"

在“C:\ Program Files”文件夹中找到文本“exe”

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

这里参考http://msdn.microsoft.com/en-us/library/ff684385.aspx

#6


0  

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

试试“Launchy”。对于Windows和Linux。很棒的工具。

#7


0  

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

如果您只需要一个热键,那么使用Win + f。

#8


0  

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

有点不清楚你想要的最终结果是打开的“查找”对话框,还是你只是在寻找一种搜索任意目录的命令行方式。如果后者有FINDSTR(假设您要搜索文件的内容而不是其名称):

What are good grep tools for Windows?

什么是Windows的优秀grep工具?

#9


0  

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.

除了Ben Dunlap的回答:您还可以在DIR命令的输出上使用FINDSTR(例如在FOR循环中)这将搜索文件名,而不是文件。

#10


0  

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

基于Vitim.us从cmd的回答,您只需要explorer.exe“search-ms:query = * .exe&crumb = location:C:\ Program Files&”根据需要更改位置和查询

#11


-1  

Why don't you try bashing F3? :)

你为什么不试着抨击F3? :)

#1


3  

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


5  

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.

这不是您问题的确切答案,但您可以使用Locate32而不是Windows搜索工具。它有一整套命令行选项,并且具有索引搜索的巨大优势,这意味着结果将立即显示。这是我在Windows上不能没有的工具。

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

这是您在D:\ home中搜索所有index.php文件时要发出的命令:

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.

-r开关在没有用户干预的情况下立即进行Locate32搜索(没有它,接口将启动并填充字段,但您必须按Enter键才能继续搜索)和-p D:\ home是搜索路径。

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

使用AutoHotKey,将上述命令分配给键盘快捷键很简单。

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.

在名为locate.exe的同一个包中还有一个完全基于命令行的Locate32版本。它使用与Locate32相同的索引,但由于它完全基于CLI,脚本语言和其他工具可以使用它来利用它提供的极快的搜索性能。

#3


4  

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.

F3或Win + F是一个将启动查找文件的热键。如果您随后使用所需的条件进行搜索,则可以使用“文件”菜单保存搜索。这会创建一个.FND文件。可以从命令行或使用autohotkey创建的热键启动FND文件。

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.

可以编辑.FND文件(二进制文件)并更改它所搜索的内容,但我会避免这样做,除非它是您完成所需内容的唯一方法。我试过了,它工作正常。

#4


3  

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.

从命令行无法让Explorer显示“搜索文件”窗格。但你可以用一些VBScript来克服它。

Try this

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

And compile it with cscript /nologo ExplorerFind.vbs

并使用cscript / nologo ExplorerFind.vbs编译它

#5


3  

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

只需执行此行! (WinKey + R,CmdPrompt,Shortcut,ShellExecute,WinExec等)

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"

在“C:\ Program Files”文件夹中找到文本“exe”

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

这里参考http://msdn.microsoft.com/en-us/library/ff684385.aspx

#6


0  

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

试试“Launchy”。对于Windows和Linux。很棒的工具。

#7


0  

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

如果您只需要一个热键,那么使用Win + f。

#8


0  

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

有点不清楚你想要的最终结果是打开的“查找”对话框,还是你只是在寻找一种搜索任意目录的命令行方式。如果后者有FINDSTR(假设您要搜索文件的内容而不是其名称):

What are good grep tools for Windows?

什么是Windows的优秀grep工具?

#9


0  

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.

除了Ben Dunlap的回答:您还可以在DIR命令的输出上使用FINDSTR(例如在FOR循环中)这将搜索文件名,而不是文件。

#10


0  

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

基于Vitim.us从cmd的回答,您只需要explorer.exe“search-ms:query = * .exe&crumb = location:C:\ Program Files&”根据需要更改位置和查询

#11


-1  

Why don't you try bashing F3? :)

你为什么不试着抨击F3? :)