20 Common DOS Commands Summary _dos/bat

Source: Internet
Author: User
Tags create directory disk usage
Let's first introduce the concept of wildcard characters.

Wildcard * and?

* Represents a String

? Represents only one character

Note Wildcard characters can only be wildcard file names or extensions, and cannot be all represented. For example, to find all the files that start with the letter Y, you can enter the following command: Dir y*.*; If you want to find all files with an exe extension, dir. exe.? Represents only one character, for example, I'm looking for all the files with the second letter S, and 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.

[feature] Displays the file and subdirectory information in the specified disk, directory, includes information such as the volume label of the disk on which the file and subdirectory reside, the name of the file and subdirectory, the size of each file, the date and time that the file and directory were established, and the number of file subdirectories, the total number of bytes consumed, and the remaining total space on the disk.

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

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

Parameters
Significance

/P
Display information when full screen, pause the display, press any key to display the next screen
Www.jb51.net
/O
Sort display. O can be followed by a different meaning of the letter

/w
Displays only the filename directory name, five file names per line. That is, wide row display

/s
Display all directory files for directories and subdirectories
/A
Show hidden files

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

2. MD

MD is an abbreviation for Make directory (create directory) in English

[feature] Create a subdirectory

[format] MD [C:]path

[For example] use MD to create a directory called Purple

3. cd

CD is the abbreviation of English change directory (changing directory)

[function] Change or display the current directory

[Format] CD [C:][path]

The description path can use both absolute and relative paths. If there are only CDs and no parameters, only the current path is displayed. Note: There must be two "special directories" in the subdirectory, that is, ".", which means 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 down a directory name), and layer out (CD ...). ) can solve all problems. Of course, you can also use the absolute path approach.
Www.jb51.net
[For example] Enter the Purple directory we just established

4. Rd

Remove directory--Delete Directory

[feature] Delete an empty directory

[Format] Rd [D:]path

[Description] Rd is a command that specifically deletes an empty directory. Note Two: First, you cannot delete a non-empty directory, and the second is that you cannot delete the current directory.

[Example] Remove purple this directory with RD

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

5. Copy

Copy in English is the meaning of copying

[feature] copy one or a set of files to a specified disk or directory

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

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

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

C:\>copy Purple a:\

If a file with the same name already exists on the destination disk, the following prompt appears, "Overwrite xxxx (yes/no/all)" Answers y at this point overwrites the current file, N retains, and a overwrites all subsequent files without asking questions.

6. del

Del is the abbreviation for the English Delete (delete)

[feature] deletes one or a set of files in a specified disk, directory

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

[description] This command should be used with care. Once deleted, it will not be easy to recover. You can also use wildcard characters to delete a class of files. When using *.*, a warning is given for security and the deletion is done by the confirming party. The deletion process, if there is no information prompt, indicates that it has been deleted correctly.

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

7. ren

Ren is a shorthand for English rename (renaming)

[feature] Change the name of a file or set of files in a specified disk, directory

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

[description] The rename operation is limited to the name of a file group of files, and it does not change the directory in which the file resides.

If a wildcard character is used, a batch of files is renamed.

8. Type

[feature] Displays text file content commands 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 name txt extension is a text file.
If you use this command to display other files with the extension exe or COM,
Output is often the result of some messy symbols and accompanied by an irregular ring, and sometimes even panic.

9. Format

[Feature] Disk format

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

[description] A variety of disks manufactured by manufacturers can be used to store files under various operating systems. The disk formats for different operating systems are generally not the same and are not universal. The Format command allows a new disk to be recognized by the DOS operating system to store a DOS file.

The format of this command for the disk is actually the process of planning the disk in a DOS-mandated information storage format. When you format a disk, you erase 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 find all the bad sectors on the disk and make them unusable. Command parameters We only have one 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 the format before the next command: SYS.

discopy

diskcopy, translation into Chinese is disk copy

[feature] Copy a disk that is identical to the original disk content

[format] diskcopy drive name of Source drive

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

deltree.

[Feature] Delete a directory tree

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

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

Mem

MEM is the abbreviation of memory
Www.jb51.net
[feature] This command is used to see how much memory you have on your computer and how it is used.

[format] Type the MEM command directly

chkdsk

CHKDSK is the abbreviation for check disk.

[function] To check the usage of your disk.

[format] CHKDSK disk name

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

SYS

[function] to pass system file commands. Transfer the two suppressed system Io.sys and Msdos.sys of DOS to a specific location on the destination disk and copy the Command.com files to the past. When finished, the target disk becomes a DOS boot disk.

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

[description] Because these files need to be copied to a specific location, copying with the copy command may not be able to start the machine. Through 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 indicated, the default is the current directory of the current disk. So this command is typically done in the root directory of the source disk.

Path--ko: Thank you, Tanglu_sd pointed out. The original text is pass. It was written wrong!

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

[format] path=[[drive:]path[;.]] or path

Edit

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

CLS

[feature] clears the contents of the monitor screen so that the DOS prompt is in the upper-left corner of the screen.

[Format] CLS

Time

[feature] displays and sets the system time for DOS

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

Date

[feature] displays and sets the system date for DOS

[format] date [MM-DD-YY]

ver

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

[Format] ver

Commands: Features:
attrib ....... Set file properties
Ctty ....... Change control equipment
Defrag ....... Disk defragmentation
Doskey ....... Invoke and create a DOS macro command
Debug ....... Program Debugging commands
Emm386 ....... Extended memory Management
Fc............ File comparisons
Fdisk ....... Hard Disk partitions
Lh/loadhigh ... To load a program into high memory
Move ....... Move file, change directory name
More ....... Split-screen display www.jb51.net
Prompt ....... Set up a prompt
Set ....... Setting environment variables
Smartdrv ..... Setting up the Disk accelerator
Setver ....... Set version
Subst ....... Path substitution
Vol. ....... Displays the specified disk volume label
Xcopy............ Copy directories and files

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

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.