Full Features of MS-DOS DIR command


Microsoft DOS command 'DIR' and its full .

MS-DOS (Microsoft DOS) has many features and we can get the advantage of command prompt. There is a popular command named DIR in MS-DOS. This command displays the list of files and subdirectories in a drive or directory.

Simply we can give DIR command on the command prompt to display the list of files and subdirectories. I am giving hereunder the complete syntax of DIR command that we can use in MS-DOS command prompt in MS-DOS, PC-DOS, Microsoft Windows 95, Windows 98, Windows ME, Windows XP etc.

I am giving hereunder all the examples using C:\Windows\System32 directory. We can use DIR command with following syntax:

DIR [drive:][path][filename][/A[[:]attributes]] [/B] [/C] [/D] [/L] [/N][/O[[:]sortorder]] [/P] [/Q] [/S] [/T[[:]timefield]] [/W] [/X] [/4]

DIR [drive:][path][filename] means drive, directory, and/or files to display the list.

DIR, C:\Windows\System32 /AD

This will display only list of directories in C:\Windows\System32

We can use "– Prefix meaning not" with every syntax as I am giving example hereunder:
DIR C:\Windows\System32 /A-D
This will display only list of files without directories in C:\Windows\System32

DIR C:\Windows\System32 /AR
This will display only list of read-only files in C:\Windows\System32

DIR C:\Windows\System32 /AH
This will display only list of hidden files in C:\Windows\System32

DIR C:\Windows\System32 /AA
This will display only list of files ready for archiving in C:\Windows\System32

DIR C:\Windows\System32 /AS
This will display only list of system files in C:\Windows\System32

DIR C:\Windows\System32 /B
This will display list using only bare format (no heading information or summary)

DIR C:\Windows\System32 /C
This will display the thousand separator in file sizes. Please note that this is the default. So we can use '- prefix meaning not' /-C to disable display list of separator. For this we can give command as DIR C:\Windows\System32 /-C

DIR C:\Windows\system32 /D
This will display the list sorted by column. This is same a wide but uses the list as column.

DIR C:\Windows\System32 /L
This will display the list in lower cases.

DIR C:\Windows\System32 /N
This will display new long list format and filename will be on the right side. Earlier MS-DOS was designed for 8.3 file name format only.

DIR C:\Windows\System32 /O
This will display the list using sorted order as per given switch.

To sort we can give following switches with /O
N - Sort by name (alphabetic)
S - Sort by size (smallest first)
E - Sort by extension (alphabetic)
D - Sort by date/time (oldest first)
G – Group directory first also we can use – Prefix to reverse order with every switch. I am giving example hereunder:
DIR C:\Windows\System32 /O-S
This will display list with largest file first and smallest file last.

DIR C:\Windows\System32 /P
This will display complete list with pauses after each screenful of information. We can use /P to pause any type of DIR display listing.

DIR C:\Windows\System32 /Q
This will display the file lists with the owner of files.

DIR C:\Windows\System32 /S
This will display files in specified directory and all subdirectories.

DIR C:\Windows\System32 /T
This controls which time field displayed or used for sorting, timefield C for Creation, A for Last Access, W for Last Written.

DIR C:\Windows\System32 /W
This will display wide list format.

DIR C:\Windows\System32 /X
This will display the short names generated for non-8dot3file names. The format ois that of /N with short name inserted before the long name. If no short name is present, blanks are displayed in its place.

DIR C:\Windows\System32 /4
This will display list using four-digit years.

Please note that switches may be preset in the DIRCMD environment variable. Override preset switches by prefixing any switch with – (hyphen). Example, /-S or /-W

Also we can save this display listing using another switch as given hereunder:
DIR C:\Windows\System32 >abc.txt
Now all the listing will be saved in abc.txt now we can open abc.txt using notepad or another text file editor.


Comments



  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name:
    Email: