Skip navigation

JSI Tip 8264. How can I open a Windows Explorer Search for Files and Folders from the command-line?


If you wanted to open a Search for Files and Folders from the command-line, you have a number of options:

To open a pre-configured search:

1. Open the Windows Explorer search manually.

2. Configure the search parameters, including any filtering you desire.

3. Perform the search. (you could Start the search and then Stop it.)

4. On the File menu, press Save Search.

5. Name the file with a .fnd extension, without any spaces in the name or folder path, like c:\folder1\mysearch.fnd.

6. In your script, add a line containing:

c:\folder1\mysearch.fnd

           OR

start c:\folder1\mysearch.fnd

To open an empty default search, using a .VBS file:

Add the following lines to your script:
@echo CreateObject("Shell.Application").FindFiles >"%temp%\FindFile.vbs"
cscript.exe //Nologo "%temp%\FindFile.vbs"
del /q /f "%temp%\FindFile.vbs"

To open an empty default search, using standard commands:

Add the following line to your script:
type nul>mt.FND&start mt.FND&del /q /f /a mt.FND
If your %TEMP% environment variable defines a folder path without any spaces, you could use:
type nul>%TEMP%\mt.FND&start %TEMP%\mt.FND&del /q /f /a %TEMP%\mt.FND



Hide comments

Comments

  • Allowed HTML tags: <em> <strong> <blockquote> <br> <p>

Plain text

  • No HTML tags allowed.
  • Web page addresses and e-mail addresses turn into links automatically.
  • Lines and paragraphs break automatically.
Publish