How to Automate Printing a Directory's Contents into a Text File??

  • Thread starter Thread starter Chuck
  • Start date Start date
C

Chuck

I have been trying to create a command that will allow me
to print a directory's contents as a text file. I had
something similar in Windows98 but can't find the
instructions. In searching, I found and made one that
allows me to right-click on a file in Explorer and print
its contents to the printer, but not to a text file. I
seem to recall that the one I used under 98 created a
file with a .prn extention in the directory in which I
right-clicked.

Instructions I found for doing it that don't work are:

C:\command.com /c dir > dir.txt

I guess it doesn't work because apparently XP has no
command.com.

A manual one that works at the dos prompt is:

C:\>dir c:\folderpath > c:\folderlist.txt

where folderpath is the name of the folder whose contents
I want to print and folderlist.txt is the name of the
created text file with the folder's contents listed in it.

I would rather have it automated so that all I have to do
is right click on the directory in explorer. Does anyone
know how to do this in XP?

Chuck
 
Thanks, but it says it can't find the command, probably
because the batch file is on the desktop because I've
been working with it. Where does it go? c:\windows?

Also, I think my batch file is wrong becasue when I
double-click on it, it prints to the printer and not to a
file. The one I have is:

@dir %1 /-p /o:gn > "%temp%\dir.txt"
@notepad /p "%temp%\dir.txt"

What's wrong with it?

Chuck
 
Chuck,

Your posts are confusing. First you said you tried a "command" (how?), now
you say you run a batch file.
By default your desktop directory will be under "\Documents and
Settings\<UserAccountName>\Desktop".

Remove "/p" switch after notepad.

KM
 
Back
Top