|
| |||
MAKE BETTER USE OF THE DIR COMMAND One of the most common commands that's used at the MS-DOS prompt in Windows 9x is the dir command. To get the most out of the dir command, examine some of its useful options. /A SWITCH The /a switch filters out directory entries that don't have the attributes set that were specified on the command line. For example: dir /a:h This command returns a list of entries in the current directory that have the Hidden attribute set. Here are the other attributes and their single letter switch codes that can be specified on the command line: * d
(Directory) If you want to list the subdirectories within the current directory but not list any files, issue the following command: dir /a:d You can also reverse the filter, listing all the files in the current directory but none of its subdirectories, by adding the - operator, such as: dir /a:-d /O SWITCH The /o switch lets you sort selected files using the normal selection arguments based on these codes: * n
(Name) For example, the following command lists all the .doc files in the current directory in order of size, with the smallest file first: dir *.doc /o:s It's also
possible to reverse this filter, listing all the .doc files in the current
directory in order of size, with the largest file first, by dir *.doc /o:-s /V OPTION The /v option (for Verbose) opens up some good information in the directory listing that isn't normally visible without running additional commands on the selected files. Here's an example: dir *.* /v This command returns a list of files and subdirectories in the current directory, along with the following information: * Real vs.
allocated disk size At the end of the listing, the /v option also returns the percentage of the drive currently in use. AUTOMATIC DIR COMMAND ACTIVATION Windows 9x has a reserved environment variable called DIRCMD, which is used specifically with the dir command to automate command-line options. For example, if you decide that you always want to list the selected files with the largest first, with the Verbose option turned on, open the MS-DOS prompt window and enter this command: Set DIRCMD=/o:-s /v Now, when you run a dir command, it automatically applies these options. To make options permanent through reboots, add them to the Autoexec.bat file. Clear the options by entering the following command in the MS-DOS prompt window: Set DIRCMD= | ||||