# How to Create a File List at a Command Prompt



## pyritechips (Jun 3, 2002)

Have you ever wanted to print out a list of files in a folder? This handy trick will generate a text file of the contents of any folder on your computer. When generated it will look like this:










I got this from the Windows Family, W98se section but it works great in W2K also. I used this to print out a list of what is on the CDs i used to back up all my files. Much easier than hand writing or typing out the names of a thousand picture files! 
- - -

1. Click Start, point to Programs, and then click MS-DOS Prompt (or Command Prompt in Windows NT).

2.At a command prompt, locate the drive that contains the folder whose contents you want to list. For example, if you want to create a text file that contains a list of the contents of a folder on drive C, type the following command at a command prompt, and then press ENTER:

c:

3. At a command prompt, locate the folder whose contents you want to list. For example, if you want to create a text file that contains a list of the contents in the Windows folder on drive C, type the following commands at a command prompt, and press ENTER after you type each command:

cd\
cd windows

4. Type the following command at a command prompt, and then press ENTER, where filename is the name of the text file that you are creating:

dir > filename.txt

For example, if you want to create a file named Windowsfolderlist.txt, type the following command at a command prompt, and then press ENTER: 
dir > windowsfolderlist.txt

NOTE: The text file that you create is located in the folder that you are in when you follow these steps. In the earlier example, the Windowsfolderlist.txt file is located in the Windows folder.

5. Use a text editor, such as Notepad, to view or print this file.

NOTE: You cannot export or print a list of the files that are contained in a folder in Windows Explorer.


----------



## Stoner (Oct 26, 2002)

Hi Jim,

Two other methods for printing out directories and file contents:

Karen's Directory Printer at
http://www.karenware.com/powertools/ptdirprn.asp

and Prin.bat:



> The information in this article applies to:
> Microsoft Windows 98
> Microsoft Windows 98 Second Edition
> Microsoft Windows Millennium Edition
> ...


----------



## zephyr (Nov 6, 2003)

I'm going to have to second the motion for Karen's Dirprint freebie. Just look at the options:


----------



## zephyr (Nov 6, 2003)

> NOTE: You cannot export or print a list of the files that are contained in a folder in Windows Explorer.


Jim, I have never had that problem. Can you explain further?


----------



## pyritechips (Jun 3, 2002)

No I can't explain. Like I mentioned, that is a Microsoft artile I listed. Those are their words, not mine. Sorry.

But I have a question for you: can The above app print a list from a CD? With the command line I posted, it writes the created file to the directory being listed; obviously it can't write to a CD-ROM.


----------



## zephyr (Nov 6, 2003)

Yes, Karen's software can handle any media you choose to select. It places a right-click item on the context menu and choosing the item named DirPrint (actually anything you choose to name it) will produce the screen I posted above. From there all sources are equal and you have full control over where it goes.

Now I'll have to study on what the heck MS could have meant by that. MS speak always gives me a headache so perhaps I'll just let them slide this time. 

Thanks for the comeback Jim.


----------



## brendandonhu (Jul 8, 2002)

Jim - cd to any directory you want the list from and

dir > C:\Windows\Desktop\file.txt


----------

