|
DOSKEY Special Characters
The following special characters can be used in macros to control command operations:
Characters |
What is does |
$G |
Redirects output – equivalent to the redirection symbol > |
$G$G |
Appends output to the end of a file - equivalent to the append symbol >> |
$L |
Redirects input - equivalent to the symbol < |
$B |
Sends macro output to a command - equivalent to the pipe symbol | |
$T |
Separates commands when creating macros or typing commands on the DOSKEY command line |
$$ |
Use for the $ sign |
$1 to $9 |
Represents any command-line parameters that can be specified when the macro is run. Comparable with the %1 to %9 characters in batch programs |
$* |
Represents command-line information that can be specified when macroname is written. $* is similar to the replaceable parameters $n except that everything typed on the command line after macroname is substituted for the $* in the macro. |
DIR
Displays the list of Files and Subdirectories in a Directory.
Syntax:
DIR [drive:] [path] [filename] [/Switches]
Switch |
What Is does |
none |
By default, DIR displays:
- a header comprising the disk's volume label and serial number;
- a list of all files and subdirectories in the current directory in the order they are listed in the FAT except those marked 'hidden' and/or 'system'. Along with each file/directory is its size, date/time of last modification, and long file name;
- a footer comprising the total number of files listed, their cumulative size, and the free space (in bytes) remaining on the disk.
|
/A [attributes] |
Displays files with and without specified attributes. Multiple attributes can be specified with no spaces between them.
attributes (Using the "-" as a prefix specifies "not")
D Directories
R Read-only files
H Hidden files
A Files modified since last back-up
S System files |
/O
[sortorder] |
List files in sorted order.
If order of sorting is not specified, directories are listed alphabetically followed by files, also listed alphabetically. Any combination of sorting order keys can be specified and files will be sorted in the order of the keys.
sortorder (Using "-" as a prefix reverses the order)
N By name (alphabetic)
S By size (smallest first)
E By extension (alphabetic)
D By date & time (earliest first)
G Group directories first
A By Last Access Date (earliest first) |
/S |
Displays Files in the specified Directory and all its Subdirectories |
/W |
Wide list format. File and Directory names are listed in 5 columns |
/B |
Bare format. Files and Directories are listed in a single column without header, summary, or any details. |
/L |
Output is in lowercase. |
/P |
Pauses with each screen, full of information. Press any key to see the next screen. |
/V |
Forces to Verbose mode. This displays attributes, date last accessed, and disk space allocated for each file, in addition to the standard information. |
/Z |
Long file names are not displayed in the file listing. |
/4 |
Displays the date as four digits rather than two. |
The DIR command only accepts one path as a parameter. Long file and Directory names that include a space must be enclosed in inverted commas. You can also use wildcards such as * and ? to display a listing of a subset of files and subdirectories.
DIR can be used with the standard period (.) shortcuts to show higher level directories. If more periods are used than are required to show the root directory, the directories and files.
When using redirection to send the output of DIR command to a file or another command, it is often useful to use /A:-D to list only files, and /B to avoid extraneous information such as files sizes, headers and summary information. Also when the output of a DIR command is redirected via a pipe, a temporary file is created which is automatically deleted once the operation is completed.
By default, this temporary file is located in the directory specified by the "TEMP" environmental variable but, if this is not specified or cannot be found, it will be created in the current directory of the current drive. If the DIR command also refers to the current directory, any such temporary files will be picked up and included in the listing.
|
|