Site hosted by Angelfire.com: Build your free website today!

MS-DOS Internal Commands

The DIR Command

Description:

Displays a list of files and subdirectories in a directory.

Command Syntax:

DIR [drive:][path][filename] [/P] [/W] [/A[[:]attribs]] [/O[[:]sortord]] [/S] [/B] [/L] [/C[H]]

Syntax Explanation:

[drive:][path][filename] specifies drive, directory, and/or files to list.
[/P] pauses after each screenful of information.
[/W] uses wide list format.
[/A] displays files with specified attributes.
[attribs] D Directories, R Read-only files, H Hidden files, S System files, A Files ready to archive, - Prefix meaning "not".
[/O] list by files in sorted order.
[sortord] N By name (alphabetic), S By size (smallest first), E By extension (alphabetic), D By date & time (earliest first),G Group directories first, - Prefix to reverse order, C By compression ratio (smallest first)
[/S] displays files in specified directory and all subdirectories.
[/B] uses bare format (no heading information or summary).
[/L] uses lowercase.
[/C[H]] displays file compression ratio; [/CH] uses host allocation unit size.

Switches may be preset in the DIRCMD environment variable. Override preset switches by prefixing any switch with - (hyphen)--for example, /-W.

Command Use:

This command can be used at the command prompt and in batch files.