Windows 7 / Getting Started

Paginating Long Listings

If dir prints more names than you can see on the screen at one time, you can scroll back through the listing using the Command Prompt window's scrollbar. You can also ask dir to print only 24 lines at a time-the amount that fits in the default window size-by adding /p to any dir command.When you've caught up with the listing, press Enter to print the next screenful. For example, dir %windir% /p lists the contents of the Windows folder a page at a time.

Searching for Particular Files

You can specify individual filenames or folder names, using wildcards if desired, to limit the listing to specific files and locations.The command dir *.exe lists only files ending in .exe, and dir m*.* lists only files starting with the letter m.

You can add /s to any dir command to make the listing include all subdirectories of the folder in which dir starts its search. For example, dir c:\*.mp3 /s /p locates all MP3 files anywhere on drive C: because it starts in the root directory C:\ and examines all subdirectories. Of course, you can use the Windows Search window to perform this sort of task, but when you already have the Command Prompt window open, it can sometimes be quicker to type a command like this than to poke around with Windows. Of course, whether you use dir or the Search window, you only see files in folders for which you have read permission.

Making Columnar Listings

The options /w and /d print listings of filenames that are arranged in several columns; the exact number of columns is difficult to predict because dir makes the columns wider or narrower depending on the length of the longest filename it finds.The difference between the two options is that /w lists the names by rows, whereas /d sorts them into columns.The /w listing looks like this:

Volume in drive C has no label.
Volume Serial Number is DC77-E725

Directory of C:\simh\ibm1130\sw\dmsr2v12

[.] 		[..] 		ABOOTPT.asm 	ABOOTPT.bin 	ABOOTPT.lst
ASYSLDR1.asm 	ASYSLDR1.bin 	ASYSLDR1.lst 	CSYSLDR2.asm 	CSYSLDR2.bin
CSYSLDR2.lst 	DBOOTCD.asm 	DBOOTCD.bin 	DBOOTCD.lst 	DCILOADR.asm
DCILOADR.bin 	DCILOADR.lst 	dmsr2v12.zip 	DSYSLDR1.asm 	dsysldr1.bin
dsysldr1.lst 	FSYSLDR2.asm 	FSYSLDR2.bin 	FSYSLDR2.lst 	JADUPCO.asm
...

The /w and /d options are particularly useful to get printable listings of your files.

[Previous] [Contents] [Next]