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
Yep, it works very well ! – pelms – 2016-07-22T15:20:36.187
I no longer have a windows computer :-( Can someone test this out and notify me if it works so that I can give and31415 credit for the solve? – mrbinky3000 – 2014-04-21T19:27:06.677