Displays a sorted list of files and sub-directories in a directory.
DIR [drive:][path][filename] [/A[[:]attributes]] [/B] [/D] [/F] [/J] [/L] [/N] [/O[[:]order]] [/P] [/S] [/T[[:]timefield] [/V] [/W] [/X] [/4]
[drive:][path][filename] Specifies the drive, directory, and/or files to list. /A Displays files with specified attributes, where attributes are :-
D Directories R Read-only files H Hidden files A Archive files S System files - Prefix meaning NOT /B Uses bear format (only display file names). /D Same as wide directory list but sorted into columns instead of rows. /F Uses 8.3 file name directory format, when possible. /J Right justified file name extensions for 8.3 file names. /L Display file names in lower case. /N Uses new long file name directory format. /O Display files sorted in the specified order, where order is :-
G Group directories first N By name (alphabetic) E By file extensions D By file date and time (earliest first) S By file size (smallest first) - Prefix to reverse the order /P Ignored. /S Process sub-directories. /T Display or sort on this timefield. where timefield is :-
C Creation A Last access W Write /V Display Volume Name and Serial Number. /W Uses wide list format. /X Display short filename equivalents next to the long filename. If no short filename exists, then spaces are displayed instead. /4 Force the displaying of 4 digit file dates.
When the /F switch is specified and a directory contains files that conform to the 8.3 file naming convention, then regardless of the file system, the directory listing will be formatted with file names on the left hand side of the listing, otherwise the new long file name directory format is used. In the new long file name directory format the file names appear on the right hand side of the listing.
Switches that are preset in the DIRCMD environment variable are ignored.