text stringlengths 0 4.23k |
|---|
Display alternate data streams of the file. |
/? |
Displays help at the command prompt. |
[<drive>:][<path>] |
[<filename>] |
<attributes> |
<sortorder> |
If sortorder isn't specified, dir /o lists the directories alphabetically, followed by the files, which are also sorted alphabetically. |
<timefield> |
Remarks |
To use multiple filename parameters, separate each file name with a space, comma, or semicolon. |
You can use wildcard characters (* or ?), to represent one or more characters of a file name and to display a subset of files or subdirectories. |
You can use the wildcard character, *, to substitute for any string of characters, for example: |
dir *.txt lists all files in the current directory with extensions that begin with .txt, such as .txt, .txt1, .txt_old. |
dir *.txt |
dir read *.txt lists all files in the current directory that begin with read and with extensions that begin with .txt, such as .txt, .txt1, or .txt_old. |
dir read *.txt |
dir read *.* lists all files in the current directory that begin with read with any extension. |
dir read *.* |
The asterisk wildcard always uses short file name mapping, so you might get unexpected results. For example, the following directory contains two files (t.txt2 and t97.txt): |
C:\test>dir /x |
Volume in drive C has no label. |
Volume Serial Number is B86A-EF32 |
Directory of C:\test |
11/30/2004 01:40 PM <DIR> . |
11/30/2004 01:40 PM <DIR> .. |
11/30/2004 11:05 AM 0 T97B4~1.TXT t.txt2 |
11/30/2004 01:16 PM 0 t97.txt |
You might expect that typing dir t97\* would return the file t97.txt. However, typing dir t97\* returns both files, because the asterisk wildcard matches the file t.txt2 to t97.txt by using its short name map T97B4~1.TXT. Similarly, typing del t97\* would delete both files. |
dir t97\* |
dir t97\* |
del t97\* |
You can use the question mark (?) as a substitute for a single character in a name. For example, typing dir read???.txt lists any files in the current directory with the .txt extension that begin with read and are followed by up to three characters. This includes Read.txt, Read1.txt, Read12.txt, Read123.txt, and Readme1.txt, but not Readme12.txt. |
dir read???.txt |
If you use /a with more than one value in attributes, this command displays the names of only those files with all the specified attributes. For example, if you use /a with r and -h as attributes (by using either /a:r-h or /ar-h), this command will only display the names of the read-only files that aren't hidden. |
/a:r-h |
/ar-h |
If you specify more than one sortorder value, this command sorts the file names by the first criterion, then by the second criterion, and so on. For example, if you use /o with the e and -s parameters for sortorder (by using either /o:e-s or /oe-s), this command sorts the names of directories and files by extension, with the largest first, and then displays the final result. The alphabetic sorting by extension causes file names with no extensions to appear first, then directory names, and then file names with extensions. |
/o:e-s |
/oe-s |
If you use the redirection symbol (>) to send this command's output to a file, or if you use a pipe (|) to send this command's output to another command, you must use /a:-d and /b to only list the file names. You can use filename with /b and /s to specify that this command is to search the current directory and its subdirectories for all file names that match filename. This command lists only the drive letter, directory name, file name, and file name extension (one path per line), for each file name it finds. Before you use a pipe to send this command's output to another command, you should set the TEMP environment variable in your Autoexec.nt file. |
> |
| |
/a:-d |
Examples |
To display all directories one after the other, in alphabetical order, in wide format, and pausing after each screen, make sure that the root directory is the current directory, and then type: |
dir /s/w/o/p |
The output lists the root directory, the subdirectories, and the files in the root directory, including extensions. This command also lists the subdirectory names and the file names in each subdirectory in the tree. |
To alter the preceding example so that dir displays the file names and extensions, but omits the directory names, type: |
dir /s/w/o/p/a:-d |
To print a directory listing, type: |
dir > prn |
When you specify prn, the directory list is sent to the printer that is attached to the LPT1 port. If your printer is attached to a different port, you must replace prn with the name of the correct port. |
You can also redirect output of the dir command to a file by replacing prn with a file name. You can also type a path. For example, to direct dir output to the file dir.doc in the Records directory, type: |
dir > \records\dir.doc |
If dir.doc does not exist, dir creates it, unless the Records directory does not exist. In that case, the following message appears: |
File creation error |
To display a list of all the file names with the .txt extension in all directories on drive C, type: |
dir c:\*.txt /w/o/s/p |
The dir command displays, in wide format, an alphabetized list of the matching file names in each directory, and it pauses each time the screen fills until you press any key to continue. |
diskcomp |
Compares the contents of two floppy disks. If used without parameters, diskcomp uses the current drive to compare both disks. |
Syntax |
diskcomp [<drive1>: [<drive2>:]] |
Parameters |
Parameter |
Description |
<drive1> |
Specifies the drive containing one of the floppy disks. |
/? |
Displays help at the command prompt. |
<drive1> |
Remarks |
The diskcomp command works only with floppy disks. You cannot use diskcomp with a hard disk. If you specify a hard disk drive for drive1 or drive2, diskcomp displays the following error message: |
Invalid drive specification |
Specified drive does not exist |
or is nonremovable |
If all tracks on the two disks being compared are the same (it ignores a disk's volume number), diskcomp displays the following message: |
Compare OK |
If the tracks aren't the same, diskcomp displays a message similar to the following: |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.