Summary of 20 Common DOS commands

Source: Internet
Author: User
Tags disk usage

Let's start with the concept of wildcard characters.

Wildcard characters * and?

* Represents a String

? Represents only one character

Note that wildcard characters can only be used with filenames or extensions, and cannot be represented. For example, to find all the files that begin with the letter Y, you can enter the following command: Dir y*.*; If you want to find all files with an exe extension, you can use the dir. exe. Represents only one character, for example, if I want to find all the files with the second letter S, you can enter: DIR? s*.*.

1. Dir

DIR is an abbreviation for the English word directory (directory), which is used primarily to display files and subdirectories in a directory.

[Features] Displays information about the files and subdirectories in the specified disk, directory, including the volume label of the disk on which the file and subdirectory resides, the name of the file and subdirectory, the size of each file, the date time the file and directory was established, and the number of subdirectories, the total number of bytes consumed, and the total remaining space on the disk.

[Format] dir [c:][path][filename][.ext][/o][/s][/p][/w][/a]

[Description] dir is one of the most common DOS commands. A slash indicates that the following is a parameter. The most common DOS parameters are the following four:

Parameters
Significance

/P
Display message when full screen, pause display, press any key to display the next screen
Www.jb51.net
/O
Sort the display. O can be followed by letters of different meanings

/w
Only the filename directory name is displayed, with five file names per line. That is, wide line display

/s
Displays all catalog files for directories and subdirectories
/A
Show hidden files

[Example] Displays the information in the C:\WINDOWS\Desktop folder

2. MD

MD is an abbreviation for the English make directory (create directory)

[function] Create a subdirectory

[format] MD [C:]path

[Example] using MD to create a directory called Purple

3. cd

CD is an abbreviation for English change directory (changing directories)

[function] Change or display the current directory

[Format] CD [C:][path]

The [description] path can use both absolute and relative paths. If there is only a CD and no parameters, only the current path is displayed. Note: There must be two "special directories" in the subdirectory, that is, "." "". ", where a point represents the current directory, and two points represents the previous level of the directory. From a simple and practical point of view, we just have to learn to step into the layer (CD under a directory name), and exit by Layer (CD). ) can solve all problems. Of course, you can also use absolute paths.
Www.jb51.net
[For example] Enter the purple directory we just created

4. Rd

Remove directory--Delete Directory

[Function] Remove empty directory

[Format] Rd [D:]path

[Description] Rd is a command that specifically removes empty subdirectories. Note Two: One can not delete the non-empty directory, and the second is not to delete the current directory.

[Example] using rd to delete purple this directory

Let's use the three commands of MD, CD, RD.

5. Copy

Copy in English is the meaning of copying

[function] Copy a file or a set of files to a specified disk or directory

[format] copy [C:][path][filename.ext] [C:][path]filename.ext

[Description] The basic usage of the Copy File command is: "Copy source file name destination file name." If you write only the destination path and do not write the destination file name, it is copied with the same name, otherwise known as a change name. Note Change name replication generally do not change the file name extension.

[For example] copy all the files of the C:\purple directory to a floppy disk, you can hit the following command, please note that the current disk is different from the current path:

C:\>copy Purple a:\

If there is already a file with the same name on the target disk, the following prompt appears, "Overwrite xxxx (yes/no/all)" At this point, the answer is "Y" overwrites the current file, n is reserved, a overwrites all subsequent files and no longer asks questions.

6. del

Del is an abbreviation of the English Delete (delete)

[function] Delete a file or a set of files in a specified disk, directory

[Format] del [C:][path]filename.ext

[note] This command should be used with caution. Once deleted, it will not be easy to recover. You can also use wildcard characters to delete a class of files. When using the *. *, the warning is given for security, and the determination party is removed. The removal process, if there is no informational hint, indicates that it was deleted correctly.

Note that this command cannot delete files that have read-only, suppressed, system attributes, or "File not found" if the specified file does not exist, and DOS-to-delete files can be recovered with undelete external commands; it can only delete files and not delete directories.

7. ren

Ren is a shorthand for English rename (renaming)

[function] Changes the name of a specified disk, a file in a directory, or a set of files

[Format] ren [c:][path]filename1[.ext] filename2[.ext]

[Description] Renaming is limited to the name of a group of files in a file, and it does not change the directory in which the file resides.

If wildcard characters are used, rename a batch of files.

8. Type

[function] Displays the text file Content command on the screen

[format] Type [c:][path]filename.ext

The [description] Type command is used to quickly and easily display the contents of a text file on the screen, and a file with the extension txt is a text file.
If you use this command to display other files with the extension exe or COM,
The result of the output is often a jumble of symbols accompanied by irregular ringing of the ring, and sometimes even the freezing phenomenon.

9. Format

[Function] Disk formatting

Format [C:] [Path]format drive:[/s]

[description] Manufacturers of various types of disk can be used to store a variety of operating system files. Disk formats for different operating systems are generally not the same and are not generic. The Format command allows a new disk to be recognized by the DOS operating system to store DOS files.

This command-to-disk format process is actually a process of planning a disk with a DOS-defined information storage format. When you format a disk, you clean up all the data that already exists on the disk, write the boot record on the disk, divide the file allocation table and the root directory, and it also finds all the bad sectors on the disk and makes the tokens unusable. Command parameters We only have a list here:/S. When this parameter is used, the disk is formatted and loaded into the operating system file, making it the boot disk. Corresponds to format before the next command: SYS.

Ten. Discopy

diskcopy, translated into Chinese is a disk copy

[function] Copies a disk that is identical to the original disk contents

[format] diskcopy drive name of Source drive

[description] Its main purpose is to backup. For example, when we first bought the computer, there will be a random number of device driver disk, these drivers may be used in the future, in order to prevent damage to these disks, it is necessary to back up a set of them, at this time, the use of the diskcopy command is relatively fast and convenient.

deltree.

[function] Delete directory tree

Format [C:] [Path] deltree [C1:][path1] [[C2:][path2] [...]

[description] This command destroys the entire specified directory tree, regardless of whether it is read-only, hidden, or not. Use should be particularly careful. It is a dangerous order.

Mem

MEM is the abbreviation for memory
Www.jb51.net
[function] This command is used to see how much memory your computer has, and how memory is used.

[format] Type the MEM command directly

. Chkdsk

CHKDSK is the abbreviation for check disk.

[function] is used to check the usage of your disk.

[format] CHKDSK disk name

[note] For example, to check the use of a disk, enter Chkdsk A:, check the use of C drive, enter CHKDSK c:, if you enter CHKDSK directly, check the current disk usage.

. sys

[Function] Transfer System file command. Transfer the two suppressed system Io.sys and Msdos.sys of DOS to a specific location on the target disk and copy the Command.com file in the past. Upon completion, the target disk becomes a DOS boot disk.

Format [C:] [Path] SYS [C1:][path] D2:

[note] Because these files need to be copied to a specific location, replication done with the copy command may not be able to start the machine. With the SYS command, DOS can move the target disk to a specific location and copy the system files to the appropriate location. The parameter c1ath is used to indicate the directory where the system files reside. If not specified, the default is the current directory of the current disk. So this command is usually done in the root directory of the source disk.

. Path--ko: Thank you, tanglu_sd points out. The original is a pass. It was written in the wrong language!

[function] Set DOS to look for. COM,. Exe. The directory where the bat file is located

[Format] path=[[drive:]path[; or path

. Edit

The [function] Edit command is a simple editing software that we often use to edit some programs and batch files.

. CLS

[function] Clear the contents of the display screen, so that the DOS prompt to the upper left corner of the screen.

[Format] CLS

Time

[function] Displays and sets the DOS system time

[Format] time [hh[:mm[:ss[.cc]]

. Date

[function] Displays and sets the system date of the DOS

[format] date [MM-DD-YY]

. Ver

[function] Displays the version number of the DOS system that is running

[Format] ver

Command: function:
attrib ....... Setting file properties
Ctty ....... Change control equipment
Defrag ....... Defragment a disk
Doskey ....... Calling and building DOS macros
Debug ....... Program Debug Commands
Emm386 ....... Extended memory Management
Fc............ File comparison
Fdisk ....... Hard disk Partitioning
Lh/loadhigh ... Load a program into high-end memory
Move ....... Move file, change directory name
More ....... Split screen Display www.jb51.net
Prompt ....... Set prompt
Set ....... Setting environment variables
Smartdrv ..... Set up disk Accelerators
Setver ....... Set version
Subst ....... Path substitution
Vol ....... Displays the specified disk volume label
Xcopy............ Copying directories and files

More DOS commands can refer to http://www.jb51.net/shouce/dos/

Summary of 20 Common DOS commands

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.