Full Features of MS-DOS DIR command

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 C:\Windows\System32 /CThis 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 /DThis will display the list sorted by column. This is same a wide but uses the list as column.

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

DIR C:\Windows\System32 /NThis 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 /OThis will display the list using sorted order as per given switch.

To sort we can give following switches with /ON - 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-SThis will display list with largest file first and smallest file last.

DIR C:\Windows\System32 /PThis 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 /QThis will display the file lists with the owner of files.

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

DIR C:\Windows\System32 /TThis 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 /WThis will display wide list format.

DIR C:\Windows\System32 /XThis 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 /4This 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.txtNow all the listing will be saved in abc.txt now we can open abc.txt using notepad or another text file editor.

Comments

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.

About IndiaStudyChannel.com

Being the most popular educational website in India, we believe in providing quality content to our readers. If you have any questions or concerns regarding any content published here, feel free to contact us using the Contact link below.