Click here to Skip to main content
65,938 articles
CodeProject is changing. Read more.
Articles / operating-systems / DOS

Print files list using DOS

5.00/5 (5 votes)
7 Oct 2011CPOL 25.4K  
Printing files list(in a directory) using DOS

Description


Sometimes we want to print the list of files in a directory. Example: Print the songs list in a CD/DVD.

In DOS, using DIR command(with additional parameters), we can achieve this thing.

Syntax


To print the files list:
dir /b > prn

To save the list as a file:
dir /b > filename.txt

dir - Command
/b - Parameter. For bare format (Displays only file names. No heading information or summary).

Output


Now I'm executing this command in C Drive (on my system):
C:\> dir /b > CDriveFiles.txt

Now open the file CDriveFiles.txt to view the contents:
AUTOEXEC.BAT
CONFIG.SYS
Documents and Settings
Intel
Program Files
WINDOWS

Using other parameters of DIR command, you can change the output.

Further Reading


DOS Command: DIR[^]

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)