Save File Listing to .txt File

  • Thread starter Thread starter Jack Mills
  • Start date Start date
J

Jack Mills

How can I change the Printdir.bat code presented in
Microsoft Knowledge Base Article - 321379 so that the
list of folders is SAVED to My Documents so that I can
use the list in other applications? TIA
 
Create the Dirlist.bat File
To create the Dirlist.bat file:
Click Start, click Run, type the following command, and then click OK:
notepad
Paste the following text into Notepad:

@echo off
dir %1 /o:gn > "C:\Documents and Settings\Owner\My Documents\Dirlist.txt"
exit

On the File menu, click Exit, and then click Yes to save the changes.
In the Save As dialog box, type the following text, and then click Save:
%windir%\Dirlist.bat
Create a New Action for File Folders
Click Start, click Control Panel (or, point to Settings, and then click
Control Panel), and then click Folder Options.
On the File Types tab, click File Folder.
Click Advanced, and then click New.
In the Action box, type:
Directory List
In the Application used to perform action box, type:
Dirlist.bat
Click OK.
Click OK, click OK, and then click Close.
 
I think all you need to do is to replace
"%temp%\Listing"
in line 2 of Printdir.bat with
"%homepath%\My Documents\<your required filename>"
and delete lines 3 and 4

In this example Printdir.bat would read as follows:

@echo off
dir %1 /-p /o:gn > "%homepath%\My Documents\DirectoryListing.txt"
exit

Note: this should work if the "My Documents" folder is in its default
location within C:\Documents and Settings\..... However, if the Target
Folder for "My Documents" has been changed, you will need to
substitute the actual path (C:\Documents or whatever) in place of
%homepath%\My Documents.

I hope this is clear, and that it works!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top