Using DIR

 < Day Day Up > 

Using DIR

The DIR command, which lists files and folders in either the current or any other specified drive or folder, has many options that vary with the version of Windows used.

To use the DIR command

  1. Open a command-prompt window or boot the system to a command prompt.

  2. Type DIR followed by any optional switches you want to use.

  3. Press Enter to view the results.

  4. To pause the output from DIR after each full page of date is listed, add /P (Pause) to the command.

Windows 9x/Me uses these options for DIR :

 A:/>DIR/? Displays a list of files and subdirectories in a directory. DIR [drive:][path][filename] [/P] [/W] [/A[[:]attributes]]   [/O[[:]sortorder]] [/S] [/B] [/L] [/V] [/4]   [drive:][path][filename]               Specifies drive, directory, and/or files to list.               (Could be enhanced file specification or multiple               filespecs.)   /P          Pauses after each screenful 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). Switches may be preset in the DIRCMD environment variable.  Override preset switches by prefixing any switch with - (hyphen)for example, /-W. 

Windows 2000/XP adds the following options:

 /C          Display the thousand separator in file sizes.  This is the             default.  Use /-C to disable display of separator. /D          Same as wide but files are list sorted by column. /N          New long list format where filenames are on the far right. /Q          Display the owner of the file. /T          Controls which time field displayed or used for sorting timefield   C  Creation             A  Last Access             W  Last Written /X          This displays the short names generated for non-8dot3 file             names.  The format is that of /N with the short name             inserted before the long name. If no short name is present,             blanks are displayed in its place. 

Figure WCR.1 compares the default DIR output from Windows 9x/Me (top) with Windows 2000/XP (bottom).

Note that Windows 9x/Me display the LFN only if a command prompt is opened within the Windows GUI.

The options listed for DIR can be combined with each other, enabling you to use DIR to learn many different types of information about files and folders.

The following are some examples:

  • DIR/AH Displays files with the hidden attribute (see the discussion of ATTRIB later in this chapter) in the current folder.

  • DIR/S command.com Displays all instances of Command.com in the current folder and all folders beneath the current folder.

  • DIR/O-S C:\WINDOWS Displays all files in the folder C:\Windows in order by size, largest first.

Figure WCR.1. Default options for DIR with Windows 98 (top) compared to Windows XP (bottom). The 32-bit command interpreter (CMD) used by Windows XP uses long filenames by default.

graphics/art02fig01.gif

 < Day Day Up > 


Absolute Beginners Guide to A+ Certification. Covers the Hardware and Operating Systems Exam
Absolute Beginners Guide to A+ Certification. Covers the Hardware and Operating Systems Exam
ISBN: N/A
EAN: N/A
Year: 2004
Pages: 310

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net