dir
Lists the contents of a directory.
The dir command typed by itself, displays the disk's volume label and serial number; one directory or filename per line, including the filename extension, the file size in bytes, and the date and time the file was last modified; and the total number of files listed, their cumulative size, and the free space (in bytes) remaining on the disk. The command is one of the few commands that exist from the first versions of DOS.
dir [drive:][path][filename] [parameters]
Most commonly used parameters of dir include:
* /W : Displays the listing in wide format, with as many as five filenames or directory names on each line.
* /P : Pause at every page
* /S : Also look in subdirectories
* /Axx: Display files with the specified attributes only
* /Oxx: Modifies sort order
* /B : Uses bare format (no heading information or summary)
* > [drive:][path][filename] : To Store Result in a text file;(c:\dir > c:\fileList.txt)
Possible attributes for the A parameter are D (directories), R (read-only files), H (hidden files), A (files/directories with the archive bit on), and S (system files). The prefix - negates an attribute; attributes can be combined (e.g. /A
A means directories with the archive bit on).
Possible sort orders are N (name), S (size), E (extension), D (date and time), A (last access date), and G (group directories first). The prefix - reverses the order.
The default parameters of dir can be set using the DIRCMD environment variable.
Bookmarks