Export Windows 7 search results to a text file
Possible solution
- Press Ctrl+A to select all results.
- Hold down the Shift key, and right-click the very first item in the list.
- Choose Copy as path from the context menu.
- Paste the results in a new text file.
For example, consider using the following query in the C:\Windows\System32
folder:
type:image
The output would be something like this:
"C:\Windows\System32\oobe\background.bmp"
"C:\Windows\System32\migwiz\PostMigRes\Web\base_images\AppInstalled.gif"
"C:\Windows\System32\migwiz\PostMigRes\Web\base_images\ClickDownExpanded.gif"
"C:\Windows\System32\migwiz\PostMigRes\Web\base_images\ClickDownNormal.gif"
"C:\Windows\System32\migwiz\PostMigRes\Web\base_images\Column.bmp"
"C:\Windows\System32\migwiz\PostMigRes\Web\base_images\Documents.gif"
"C:\Windows\System32\migwiz\PostMigRes\Web\base_images\Failure.gif"
"C:\Windows\System32\migwiz\PostMigRes\Web\base_images\Programs.gif"
"C:\Windows\System32\migwiz\PostMigRes\Web\base_images\System.gif"
"C:\Windows\System32\migwiz\PostMigRes\Web\base_images\Users.gif"
"C:\Windows\System32\migwiz\PostMigRes\Web\base_images\WindowsMail.bmp"
"C:\Windows\System32\migwiz\PostMigRes\Web\base_images\WindowsMovieMaker.bmp"
"C:\Windows\System32\migwiz\PostMigRes\Web\base_images\WindowsOutlookExpress.bmp"
"C:\Windows\System32\migwiz\PostMigRes\Web\base_images\WindowsPhotoGallery.bmp"
Known limitations
- Unless you select the first item in the list, the resulting output won't be sorted properly.
- All items will be enclosed in quotes.
- Copied results always include the full path.
Post-processing
Just some ways to overcome the limitations.
Manual sort
If needed, you can manually sort the output by using the sort
command in a command prompt.
Example usage
sort "X:\Path\to\input.txt" /o "X:\Path\to\sorted.txt"
Stripping quotes
The quotes might get in the way, but the batch script below can remove them for you. Just save it as StripQuotes.cmd
(or whatever you like, just keep the .cmd
extension). The script accepts two parameter: input/output files, respectively.
Example usage
StripQuotes.cmd "X:\Path\to\myfile.txt" /o "X:\Path\to\stripped.txt"
Batch script
@echo off
if "%~2" == "" exit /b 2
type nul>"%~2"
for /f "usebackq delims=" %%G in ("%~1") do echo %%~G>>"%~2"
exit /b
Retrieving file names only
In case you don't care about the full path, you can use the batch script below. The usage isn't any different from the batch script above.
Batch script
@echo off
if "%~2" == "" exit /b 2
type nul>"%~2"
for /f "usebackq delims=" %%G in ("%~1") do echo %%~nxG>>"%~2"
exit /b
You could use the NirSoft free and versatile utility SysExporter:
SysExporter utility allows you to grab the data stored in standard list-views, tree-views, list boxes, combo boxes, text-boxes, and WebBrowser/HTML controls from almost any application running on your system, and export it to text, HTML or XML file.
With the file-search result in Explorer, SysExporter will probably already detect the search result, but if not it has a targeting icon that you can drag over to the results window. Choose the entries that you want and the required columns, sort by any of the columns, and you may then either copy the data to the clipboard or export it to a file in the format of your choice.