Computer & Technology
Full Features of MS-DOS DIR command
Posted Date: 10-Dec-2010
Computer & Technology
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
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
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]
means drive, directory, and/or files to display the list.
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:
This will display only list of files without directories in C:\Windows\System32
This will display only list of read-only files in C:\Windows\System32
This will display only list of hidden files in C:\Windows\System32
This will display only list of files ready for archiving in C:\Windows\System32
This will display only list of system files in C:\Windows\System32
This will display list using only bare format (no heading information or summary)
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
This will display the list sorted by column. This is same a wide but uses the list as column.
This will display the list in lower cases.
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.
This will display the list using sorted order as per given switch.
To sort we can give following switches with
- Sort by name (alphabetic)
- Sort by size (smallest first)
- Sort by extension (alphabetic)
- Sort by date/time (oldest first)
– Group directory first also we can use – Prefix to reverse order with every switch. I am giving example hereunder:
This will display list with largest file first and smallest file last.
This will display complete list with pauses after each screenful of information. We can use /P to pause any type of DIR display listing.
This will display the file lists with the owner of files.
This will display files in specified directory and all subdirectories.
This controls which time field displayed or used for sorting, timefield C for Creation, A for Last Access, W for Last Written.
This will display wide list format.
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.
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
Also we can save this display listing using another switch as given hereunder:
Now all the listing will be saved in abc.txt now we can open abc.txt using notepad or another text file editor.
Did you like this resource? Share it with your friends and show your love!
Responses to "Full Features of MS-DOS DIR command"
Notify me by email when others post comments to this article.
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.
to fill automatically.
(Will not be published, but
to validate comment)
Type the numbers and letters shown on the left.
Subscribe to Email
Get Jobs by Email
Forum posts by Email
Articles by Email
Awards & Gifts
Last 7 Days
j r kumar
ISC Technologies, Kochi - India. Copyright © All Rights Reserved.