65.9K
CodeProject is changing. Read more.
Home

Print files list using DOS

starIconstarIconstarIconstarIconstarIcon

5.00/5 (5 votes)

Oct 6, 2011

CPOL
viewsIcon

25421

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[^]