More Powerful DIR Switches
What else on earth can the DIR command do other than displaying the lousy directory of files? The DIR is regarded as a cheap tool from DOS which most people try to avoid. No use of it since the invention of Explorer has hidden the use of DIR. But the DIR command can actually do more things than you ever dreamt of
/P Pauses after each screen full of information. /W Uses wide list format. /A Displays files with specified attributes. attributes D Directories R Read-only files H Hidden files A Files ready for archiving S System files - Prefix meaning not /O List by files in sorted order. sortorder N By name (alphabetic) S By size (smallest first) E By extension (alphabetic) D By date & time (earliest first) G Group directories first - Prefix to reverse order A By Last Access Date (earliest first) /S Displays files in specified directory and all subdirectories. /B Uses bare format (no heading information or summary). /L Uses lowercase. /V Verbose mode. /4 Displays year with 4 digits (ignored if /V also given).
Now, to use a DIR with a display of long filenames. use the /v switch. It will even tell you the total size of of files allocated - something like Explorer. Now, to make sure they don't scroll out of the screen, use the /p switch. To look even more like Explorer, we must sort the files out. Use the /o switch to make it sort it looking like a Detail view in Explorer. File attributes never was a necessary in DOS. but now with Explorer, we have tons of files that are hidden or read only. Try the /a switch to turn view all files with their attributes. All files in Explorer are capitalized, all in lowercases, all in uppercases or mixed. However, our dear DOS will display everything in uppercase (all in capital letters) only. To enable lowercase letters, use the /l switch. Finally, if you are preparing for year 2000, use the /4 switch to enable 4 digits date.
Now that we are done discussing the more useful switches, our final DIR command will look something like this:
Much better than the original one isn't it? Now wait a minute - are we really going to type this at the command prompt just in order to get a better DIR? No we are not. Switches may be preset in the DIRCMD environment variable. Just set the DIR command like this:
Now whenever you type just DIR, DOS will help you type the whole thing - dir /v/p/o/a/l/4. Useful isn't it? To permanently stick it onto your DOS Prompt, just add this line
to your AUTOEXEC.BAT file.
|Home, Links, Awards, Help, Map, Poll, Newsgroups, Online Chat, Mailing List, Search|
|Tips & Tricks||Guides||Bugs & Fixes||Themes||Reviews||Site Contents||ActiveIE|
1998-1999 The Active Network. All rights reserved.