Share via

How to export selected directory/folder contents listing to txt file from Windows Explorer right-click context menu?

Anonymous
2014-08-04T17:50:53+00:00

Back in the early days of Windows XP, I came across this really neat batch file that allowed users to export selected directory/folder contents listing to a txt file from Windows Explorer right-click context menu.

For example:

Say you wanted to export a list of files contained within a folder, you would open Windows Explorer, select the folder which contents you wish to be exported, right click to display context menu and select "Export Directory Listing", the batch file would then create a "Directory-Listing.txt" export text file inside selected folder, really neat tool!

The problem is I can't get the batch file to work on Windows 8.1., it keeps displaying "CMD does not support UNC paths as current directories."

Here is the original article:

"Generate a File Listing from a Windows Explorer Context Menu"

Here is my modified version which worked well in XP:

<code>

@echo off

title Export Folder Listing, Version 2.0, 2014/04/08

echo.

echo Right-click on any folder in MS Windows Explorer and select

echo "Export Folder Listing" from Shortcut Menu to export it's contents

echo to: "[Selected Folder]/Export-Folder-Listing.txt".

echo.

echo.

echo Exporting: "[Selected Folder]/Export-Directory-Listing.txt"

cd %1

dir /a /b /-p /o:gen >"%temp%\Export-Directory-Listing.txt"

echo.

echo Exporting FINISHED!

echo.

echo.

echo NOTES:

echo.

echo This batch program is located in C:\Windows folder

echo (Export-Folder-Listing.bat).

copy "%temp%\Export-Directory-Listing.txt" %1 >null

del "%temp%\Export-Directory-Listing.txt" >null

echo.

echo.

echo.

PAUSE

exit

</code>

Any ideas on how to get it to work on Windows 8.1?

Windows for home | Previous Windows versions | Files, folders, and storage

Locked Question. This question was migrated from the Microsoft Support Community. You can vote on whether it's helpful, but you can't add comments or replies or follow the question.

0 comments No comments

3 answers

Sort by: Most helpful
  1. Anonymous
    2014-08-04T19:09:54+00:00

    Not really needed anymore :)  For Windows Vista onward it's built-in.

    Vista, 7, and 8

    Highlight files, hold shift while right-clicking, then choose "copy as path".  The full path of all highlighted files will be copied to your clipboard, ready to use/paste wherever you want (such as notepad).

    Windows 8 makes it even faster

    Just highlight files, then click this button:

    20+ people found this answer helpful.
    0 comments No comments
  2. Anonymous
    2014-08-06T17:40:08+00:00

    You can still do it with a batch if you want, the XP method works the same in Vista/7/8/8.1.  I just don't go to the trouble myself.

    1 person found this answer helpful.
    0 comments No comments
  3. Anonymous
    2014-08-04T22:52:14+00:00

    Wow, I'm new to Windows 8 since MS kicked us off XP, never notice that feature before, thanks.

    Still, I like the batch solution better, simpler, faster, no need manually create a file, no need to parse path, etc...

    But I guess it will have to do. Thanks again.

    0 comments No comments