hpp3 wrote:I found this on a "Tips and Tricks" site which is quite simple and uses some of the techniques mentioned before. Still not as nice as Karen's, but useful and fast nonetheless. First make a batch file named "PrintDir" (or something even more ingenious) and stick it in C:\ (or somewhere appropriate):
Code: Select all
@echo off
dir %1 /-p /o:gn > "%temp%\Listing"
start /w notepad /p "%temp%\Listing"
del "%temp%\Listing"
exit
Then make a new reg key:
Code: Select all
HKEY_CLASSES_ROOT\Directory\shell\Print Directory\command
with the following value:
Now you can right click on any directory and select the "Print Directory" command and it will print a list of all folder names inside. To print a list of files also add "/s" after the "dir" command in the batch file. In fact, look at the DIR help page for even more options, or use Editor2 instead of notepad, or....

Oh man, I gotta stop.
A few comments (I can't help myself

)
@dir %1 /-p /o:gn
this command will not only show folders, but files aswell (ordered by folders first and then files, in alfabetical order)!
The
'/-p' switch is optional, since the default is that output is not
'paginated' (the
/p switch enables this and
/-p should disable it, but I found that on my Dutch Windows XP Pro SP2
/-p also paginates output, giving you the same
'press any key to continue...' message as
/p would

)
To only show folders, sorted by name, use this in stead
The
/o:gn could be used too, but since there are no files to display, it doesn't make any difference if you use
/o:gn or
/o:n
@To print a list of files also add "/s" after the "dir" command in the batch file
This is not true, since the
/s switch will recurse into subfolders, showing the contents of all subfolders and their children too. Used like in the example it will show all files and folders in the hierarchy from the specified
'%1' folder (not hidden files and folders though).
To show all folders in the hierarchy (including hidden!; the
/ad switch shows all folders including hidden!), use this
If you want to exclude the hidden folders, use this
And finally, as a topping on the cake, if you want only the folder names listed, without all the other output about how much there were found (the headers and footers of the 'dir' command) and without the date time info in front of it, use the following command
Enjoy!
