Brief introduction to DOS and MS-DOS under Windows environment and some common commands

Remember before

He is engaged in programming, first of all, I am a rookie, contact with the computer for so long, feel a lot of computer technology and knowledge hazy, vague, some seem to laugh at; So I’ve taken some time recently to understand the basics of computers, and I think it’s not too late to sort them out.

Say to arrange, in fact is not an easy thing, each person’s vision is limited, of course, “know-it-all” I can not do, or really take out to share, cause laughter and smile, let everyone clap board brick is also not impossible.

Why learn batch processing?

First of all, I am a junior, since contact with the computer has been using the Windows operating system, but also a relatively old XP system (relative to Win7, Win8), may be used handy, until now just changed to the Win7 operating system.

Why start with batch processing? First heart is a little worship “hacker”, that NB technology really let a person envy. Batch processing was the home of DOS (Disk Operating System), the dominant computer Operating System when Windows was still in its infancy.

Computers are mentally retarded and can only recognize 0 and 1 (which we Revere as binary digits), but human intelligence is infinite and the computer brain (CPU) can be modified to support all information in the universe. Anyway, every file we look at on a computer is stored in a binary code of zeros and ones, and I’m a junior, so I don’t know how. The earliest disk operating system (DOS) realized the operation and management of files on a computer’s hard disk. I just want to say that I really want to know how DOS and batch work with files on a computer’s hard disk.

DOS and ms-dos

That’s a lot of crap. Let’s get straight to the point.

DOS (Disk Operating System), I think people who know a little about computers should not be unfamiliar with the word, but specifically what it is? DOS is a computer based on disk management operating system, you can directly operate and manage the files on the disk, in the computer factory is basically a DOS disk operating system.

DOS development to now there have been many versions, to MS-DOS, PC-DOS and FreeDOS is the most common.

Ms-dos (Microsoft-Disk Operating System) is a Disk Operating System of Microsoft and a branch of DOS. The origin of MS-DOS can be found in the data. The earliest DOS is called 86-DOS. Gates bought the rights for $5 (from the legend of Silicon Valley movie, which tells the rags-to-riches story of Steve Jobs and Uncle Gates if you have time) and renamed it MS-DOS.

The essence of the initial Windows operating system is based on the DOS system of a graphic application, until Windows2000, just from DOS essence began their own Windows operating system. Although it broke away from DOS, mS-DOS was still used in Windows operating system until Windows 7, which is probably why it was once dominant. Now that the latest version of MS-DOS is 6.x, Microsoft has announced that it will not update the MS-DOS system, of course, it is very necessary to know. How can someone like me, who doesn’t want to be new, still use XP? So everything I’m going to talk about is based on Windows XP, although most Windows 7 will work as well.

Common mS-DOS commands

1. System environment variables

The disk operating system in Windows is called MS-DOS. DOS in Windows is a window with white characters on a black background, affectionately known as the command line. Anyone familiar with Windows knows that in the Start menu there is a Run window where you can print the name of the program and then directly open the corresponding program. Therefore, we can enter “CMD” in the “Open” text box in the “Run” window to open the long-awaited command line window. “CMD” is actually a contraction of “command”.

Why does entering CMD in the Run window open the command line window? Because Windows system introduced a concept called “environment variable”, divided into “system environment variable” and “user environment variable” two types. Concrete can be through the “my computer” – > right click – > “properties” – > “advanced” – > “environment variables” to view, can also be input in the run window “sysdm. CPL” to open “my computer” – > “properties” option. You can see that in the “system environment variables” there is a variable named “Path”, there is a value of “%SystemRoot%\system32;” C: Windows \ System32 C: Windows \ System32 C: Windows \ System32 If you look at this directory, there is a “cmd.exe” executable file in it. In the same way, sysdm. CPL also exists in the directory. Why does “CMD” not need the “.exe “extension, but” sysdm.cpl “does? There is also a variable named PATHEXT in System Environment Variables, whose value is.exe; Exe will be appended automatically after we enter the name “CMD” and look for “C:\WINDOWS\ System32” to see if there is “cmd.exe” file. If there is, open it. In fact, when I enter any name in the command line or “Run” window, Windows will automatically search for all directories specified by “Path”. If I find it, I will open it. Otherwise, it will automatically add any value in “PATHEXT” (cyclic append extension and search in sequence) and search again. If found, open, otherwise error message.

The knowledge of environment variables, I mentioned here, in fact, there are a lot of built-in system environment variables, the role of these variables, you can not mean network resources, to find their own (” Baidu “not to” Google “), I believe more thorough than I say.

2. Use commands

When entering “CMD” and then “Enter” in the “Run” window, the command line window can be started. You can see that it is very simple with white characters on a black background, as shown in the picture:

Despite its simplicity, its functionality is not to be sniffed at. We can see the flashing white underline, which is actually what we call the “cursor”.

In the command line window, type “help” and enter to get a command description list of all mS-DOS command lines and command line tool commands as follows:

Name of the command Corresponding program (WINDOWS\ System32 \) instructions
assoc   Displays or modifies file name extension associations
at at.exe Displays or modifies commands and programs that are scheduled to run on the computer
attrib attrib.exe Displays or changes file properties
break   Set or clear extended CTRL+C checks, not available on XP
cacls cacls.exe Display or modify access Control Lists (ACLs) for files
call   Calling this one from another batch program enables cross-file invocation
CD or chdir   Displays or changes the name of the current directory
chcp chcp.com Displays or sets the active code page number
chkdsk chkdsk.exe Check disks and display status reports
chkntfs chkntfs.exe Displays or modifies disk check operations at startup
cls   Clear screen content
cmd cmd.exe Open another Windows command interpreter window
color   Sets the default console foreground and background colors
command command.com Open another Windows command interpreter window, essentially a form of Prompt, where all paths are short paths
comp comp.exe Compare the contents of two files or sets of files
compact compact.exe Displays or changes the compression of files on NTFS partitions
convert convert.exe Convert FAT volumes to NTFS format. And you cannot convert the currently used drive
copy   Copy at least one file to another location
date   Displays or sets the date
Del or erase   Delete at least one file
dir   Displays files and subdirectories in a directory
diskcomp diskcomp.exe Compare the contents of two floppy disks
diskcopy diskcopy.exe Copies the contents of one floppy disk to another
doskey doskey.exe Edit the command line, invoke Windows commands, and create macros
echo   Display messages and control the status of the echo (on or off)
endlocal   End localization of environment changes in batch files, that is, disable deferred environment variable extension
exit   Exit cmd.exe (command translator) or the current batch script
fc fc.exe Compare two files or sets of files and display the differences
find find.exe Searches for literal strings in file contents
findstr findstr.exe Searches for strings in file contents
for   Runs a specified command for each file in a series of files (a collection)
format format.com Formatted disk
ftype   Displays or modifies the file type used for file extension association
goto   Points the Windows command interpreter to an indicated line in the batch program
graftabl graftabl.com Enable Windows to display the extended character set in image mode
help help.exe Enable Windows to display the extended character set in image mode
if   Provides help information about Windows commands
lable lable.exe Creates, changes, or deletes a volume label for a disk
Md or mkdir   Create a directory (folder)
mode mode.com Configuring System Devices
more more.com The results are displayed in split screens, one screen at a time
move   Move files from one directory to another
path   Displays or sets the search path for executable files
pause   Pausing batch file processing and displaying messages
popd   Restore the last value of the current directory saved by pushd
print print.exe Print text file
prompt   Change the Windows command prompt
pushd   Save the current directory and make changes to it
Rd or rmdir   Delete the directory
recover   Restores readable information from the troubled disk
rem   Record comments, comment identifiers in batch files or config.sys
Ren or rename   Rename file
replace replace.exe Replace the file
set   Displays, sets, or deletes batch executable environment variables
setlocal   Starts localization of environment changes in batch files, that is, enabling deferred environment variable extension
shift   Change the position of the replaceable parameter in the batch file
sort sort.exe Classify the input
start   Launches another window to run the specified program or command
subst subst.exe Associate a path with a drive letter
time   Displays or sets the system time
title   Sets the window title for cmd.exe session
tree tree.com Displays the directory structure of a drive or path in graphical mode
type   Displays the contents of a text file
ver   Display Windows version
verify   Tell Windows whether to verify that the file was correctly written to disk
vol   Displays the disk volume label and serial number
xcopy xcopy.exe Copy files and directory trees

As can be seen from the list, some commands have corresponding applications, and these applications are in the “WINDOWS\ System32” directory, so these commands are called “external commands”; The commands for which there is no corresponding application are reserved in MS-DOS and are called “content commands”.

Anyone who knows anything about programming knows that a single command can only do one thing. All MS-DOS extend each command, called “command options,” and most command options are optional. The “command + option” approach allows for a variety of complex and different operations (note that command options and commands are often separated by Spaces). Here is a default command option that is reserved for most commands: /? This option is used to view the command documentation information. For example, enter CMD /? You can view the information about the use of the CMD command and all its options.

3. Features of commands

From the above simple examples, in fact, can be regarded as several characteristics of mS-DOS command, the following summary:

  • Ms-dos is a disk operating system designed to manage and manipulate files on disks. Therefore, it is a directory-based file manager, that is, a directory that must be specified before an operation can be performed.
  • Commands, command options, and command parameters on the command line are case insensitive. This is a common feature of Windows, where directory and file names are case insensitive. This means that mS-DOS is case-insensitive for the most part, but in some cases it is necessary, as you’ll see later.
  • The end character of a command line is a newline character (including Enter), and sometimes a blank character (including Tab and Space) can also be the end character. That is, a newline character represents a command statement.
  • The separators between commands, options, and parameters are blank characters (including Tab and Space keys). In certain cases, blank characters can be omitted.
  • Ms-dos is a single-task system. Only after one operation has been performed can the next operation be performed. We return to the initial state of the system when we have done something.
  • The shortcut key for executing a command is Enter, and the shortcut key for forcibly terminating a command is CTRL+C.

4. Describes the common MS-DOS commands

As mentioned above, you can use “command /?” To view the description of any command and all option descriptions. You can learn the usage of any command in the preceding list. There is nothing that one cannot understand if one will try. The following describes several common commands.

4.1. Drive letter switching

The drive letter, which is officially called volume label, is the letter C and D in drive C and drive D. Generally, the drive letter consists of 26 uppercase letters followed by colons. For example, C: indicates drive C, and D: indicates drive D, which marks a disk partition. Usually our Windows system is installed on disk C, so the default directory to start the command line is “C:\Documents and Settings\ Current User”. So the question is, how do we switch to another disk partition for operation? Ms-dos provides a very simple operation, that is, directly enter the drive letter, that is:

Volume Label Name:

You can enter drive letter: to switch to the root directory of the disk. If the volume label cannot be found, an error message is displayed and the system returns to the directory of the last operation.

Note: In this mode, you cannot switch from the directory in the current drive letter to the root directory of the current drive. You can only switch to the root directory of another drive.

4.2. Directory (folder) management
  • CD/CHDIR — Directory switch and display

“CD” or “CHDIR” is short for the phrase “change directory”, meaning to change a directory. It is used to change the current directory or display the full path name of the current directory. Usage:

CD | CHDIR [/ D] [target directory]

“[]” indicates optional, I believe that anyone who has learned programming should know. In essence, this command can be used in two ways. One is to display the full pathname of the directory on which the current work is based. Another option is to change the working directory to another location.

Speaking of path, here can be boldly expanded, the so-called “path” through the computer resources of a location identification way, the main purpose is used for the unique location of resources. In general, a path can be divided into two forms: Absolute path and relative path.

Absolute path – Its location is fixed by its name. It is located by a disk file identifier that describes “a location on a disk” and usually contains a drive letter.

Relative path – the name indicates that the location is relative. A reference must exist to indicate the location of a resource relative to that reference. It describes “some location relative to the current location”. , “.” , “\” operators, “..” Indicates the upper-level directory, “. Indicates the current directory. \ indicates the root directory of the current drive letter.

In Windows, “\” is used as a directory-level separator (you can also use “/”, but Windows does not recommend “/”). Use the “..” To indicate an upper-level directory, use “. It can be the current directory, and \ is the root directory of the current drive letter. Absolute paths are mostly used in MS-DOS, but relative paths are more flexible. Now let’s talk about the use of the “CD” command.

The problem is how to switch from a directory of the current drive letter to the root directory of the current drive letter. So here we can use “CD \” mode to switch to the current drive letter root directory; Also we can use “CD..” Switch a directory to a directory one level above the current directory. In fact, the target path is changeable, the target path can be relative path, also can be absolute path; By default, you cannot switch across disk partitions when the destination path is absolute, so the “CD” command provides the “/D” option to solve this problem. For example, if you type “CD /D D:\test” in the default MS-dos path, you can go directly to the D:\test directory. If the /D option is not selected, the drive letter cannot be changed. Therefore, the CD /D mode can also replace the drive letter switching mode.

  • MD/MKDIR — Directory creation

“MD” or “MKDIR” is an abbreviation of the phrase “make directory”, meaning build directory, and is mainly used to create new directories that specify the path name of the destination directory. Usage:

MD | MKDIR target directory path

This command is used to create a directory, which must specify the full pathname of the directory to be created. This command can create directories across disk partitions and create a directory tree structure, that is, create multiple non-existent nested directory structures or directory groups at the same time.

The destination directory path can be an absolute path or a relative path. Ensure that the directory name is different from an existing directory name; otherwise, an error message will be displayed. Note: If there is a blank character in the name of the created directory, use quotation marks (“”) to indicate the directory name. Otherwise, directory groups are created, with each directory name separated by a space character.

  • RD/RMDIR — Deletes a directory

“RD” or “RMDIR” is short for the phrase “remove directory”, which means to remove a directory. This command is used to delete the specified directory structure. Usage:

RD | RMDIR [/ Q] [/ S] target directory path

This command is mainly used for empty directories and can be operated across disk partitions. It can also be used to remove non-empty directory structures with enhanced options. You only need to specify the destination directory path, which can be absolute or relative.

By default, the “RD” command can only delete empty directory, or directory cannot exist in the other directory or file, otherwise it will prompt wrong, is for this reason, so “RD” command provides “/ S” option, for mandatory delete is not empty, when using the “/ S” directory is not empty when it is forced to delete delete information, Of course, you can use the /Q option to forcibly cancel the prompt message.

Using “RD” for directory deletion is generally not recommended, because as far as I know, files or directories deleted using DOS do not remain in the “recycle bin”, so do not delete important files easily, otherwise it will not be easy to retrieve after deletion.

  • DIR — display of directory contents

“DIR” is an abbreviation of the phrase “directory”, indicating a directory. It is used to view and display contents. Usage:

DIR [destination directory path] [options]

This command is used to view information about the directory structure, including subdirectories and file properties. The DIR command without specifying target directory path is used to display the current directory structure. If target Directory is specified, the directory structure of the target directory is displayed in the format of date, time, type, size, and name. This directory supports operation across disk partitions.

DIR provides a variety of disk options. You can run the DIR /? Or “Help dir” to see all the options and their description. As a reminder, the “/L” option converts subdirectories or file names to lowercase; The /S option displays the directory structure of each subdirectory. “/X” forces the displayed results into a pattern of short names.

  • TREE — Directory TREE display

The “TREE” command is similar to the “DIR” command. It is also used to display the content structure of a specified directory. It uses a “TREE” structure to display all subdirectories and files of a directory and all subdirectories and files in a subdirectory. “DIR” shows the directory structure as a list. Usage:

TREE [destination directory path] [/F] [/A]

  • This command displays the directory structure in a tree structure. The TREE command without specifying target directory path is used to display the current directory structure. If directory directory is specified, the directory structure of the target directory is displayed. This command does not support cross-partition operations.

The command contains two options. The “/F” option displays all file information. By default, only the directory structure is displayed, not the file list. “/A” is used to identify mandatory construction of structure patterns using ASCII characters.

4.3. Document management
  • TYPE — View file contents

The “TYPE” command does not indicate the file TYPE, but is used to view the file content. Note here is the content of the “TYPE” command to view all the files and print it on the command line window, but most of the files are compiled, and other processed, so the contents of these files is to calculate a series of gibberish, therefore is meaningless, so we usually use “TYPE” command to view the contents of a text file, The usage is as follows:

TYPE the destination file path [| MORE]

The command is mainly used to view text information. Therefore, you must specify the target file path, which can be a relative path or an absolute path. In addition, the command supports cross-partition operations.

Use “TYPE” command can only see a specific file contents, if too much of the contents of the documents, you can use “|” more options to implement paging display effect. “MORE” is actually a command, is a special symbol “|”.

  • COPY — File COPY/file merge

The COPY command is mainly used to COPY files. You can COPY one or more files to another location as follows:

COPY [option] Source file path [/A or /B] [+…] [Destination file path [/A or /B]]

This command is used to create a copy of a file and supports cross-partition operations.

Here we look at the difference between “/A” and “/B”, which are options immediately following files, where “/A” is used to indicate that the file is AN ASCII text file; /B indicates that the file is a binary text file. But for the most part we don’t use two options.

The COPY command provides various options. You can run the COPY /? Or “Help Copy” to view all options and their description. By default, you can specify the target path as a directory, and the directory must exist. Otherwise, an error message is displayed (you can use /D to forcibly create a target directory). In this case, the command copies the source file to the target directory. You can also specify the “destination path” as a file. In this way, the contents of the source file are read and written to the destination file. This process is called “name-copying”.

Let’s take a look at how to merge files. In essence, the process is called merge copy. If the target path is a directory, you can use “+” to connect multiple source files. Then, the command merges the contents of these files and writes them to the target file (the name of the target file is the last file name read). For example, copy C:\test\1. TXT +2. TXT D:\test “will merge the contents of 1. TXT and 2. TXT and create a file named 2. TXT in the D:\test directory. If the target path is a file, the system combines the contents of multiple files and writes them to the target file.

  • XCOPY — Copy files or directory trees

The XCOPY command is used to copy directories and files. You can copy one or more files or directories to another location. Usage:

XCOPY Source path [destination path] [options]

The command is mainly used for directory tree replication and can be extended to file replication. Source path must be specified. If target path is not specified, the default target path is the current working directory. Supports cross-disk operations.

The XCOPY command provides various options. You can run the XCOPY /? Or “Help XCopy” to see all the options and their description. By default, if no option is used, the type of destination path, F for file, D for directory, is prompted before the replication is complete. If you select a directory, the system copies the source directory and non-system and non-hidden files under the directory to the specified directory path. If you select a file, the contents of each file in the directory will be copied in turn to the destination path, which will overwrite the former, and each file will be prompted to rewrite the destination path file. Of course, you can use the “/I” option to force the target path to be processed as a directory to remove the target path type determination prompt.

By default, the XCOPY command copies only one layer of directories and their files. If the /S option is provided, a non-empty directory and non-hidden files (including subdirectory layers) under it can be copied to a specified destination path. Use the /E option to copy all directories and non-system and non-hidden files to the target path. Use the /T option to copy non-empty directories and subdirectory structures (excluding files) by value. Use the /H option to forcibly copy system files and hidden files to the destination path. Of course, they can also be combined to achieve different effects.

The /F option outputs the complete replication mapping between the parent and the target path. The /L option displays a list of files to be copied in the source path.

  • DEL/ERASE — Deletes a file

“DEL” is short for the phrase “delete”, meaning to delete; Another command to ERASE a file is ERASE, which means ERASE, and it works the same way. This command is used to delete files. You can use this command to delete one or more files and directly erase the file data from the disk. Therefore, the deleted files do not appear in the Recycle Bin. Usage:

MOVE [/Y or / -y] Source path Destination path

This command is used to erase one or more files from a disk. The target path must be an absolute path or a relative path. Supports cross-disk operations.

The “DEL” command provides various options. You can run the “DEL /? Or “Help del” to view all options and option description information. The /P option enables the confirmation prompt before deleting files, which is disabled by default. The /F option forcibly deletes read-only files. That is, by default, read-only files cannot be deleted. The /S option specifies the destination path as a directory, and files in that directory will be deleted in sequence and files in subdirectories and subdirectories of that directory will be deleted simultaneously.

  • MOVE — MOVE a file or directory/rename a file or directory

“MOVE” means to MOVE a directory. This command is used to MOVE a directory. It is equivalent to the “cut” operation in Windows. You can also derive renaming operations for directories or files, that is, moving a directory or file to a destination path with a different name. Usage:

DEL | ERASE [option] target path

This command can be used to move a file or rename a directory or file. The source path and destination path must be specified. The command has two options. The /Y option is used to cancel the confirmation prompt and the / -y option is used to display the confirmation prompt.

When a file is moved, that is, the source path is a file and the destination path can be a directory path, the file in the source path is moved to the directory in the destination path (the file name is retained). If the destination path is a file path, the file content in the source path is read and written to the destination file to implement file renaming. If multiple source files exist (split by commas), the command moves the files to the same destination path, or reads and splices the contents of multiple files and writes them into one destination file.

If the source path is a directory, you can move the source directory to the specified destination path. If the destination path and the source path are in the same relative path, you can rename the directory. Note: The “MOVE” command can MOVE (or rename) files or directories, but only files across disk partitions, not directories.

  • REN/RENAME — Renames a file or directory

“REN” or “RENAME” means to RENAME. You can change the name of a given file or directory. Usage:

The new name REN | RENAME the source path

This command is used to change the name of a file or directory. The source path and the new name must be specified at the same time. Note that the new name cannot contain the new path. This command supports cross-partition operations.

  • FC — File comparison

“FC” is short for the phrase “file compare,” which means comparing files. This command is used to compare the contents of two files. After all, it is a command line. Therefore, FC is not recommended to compare the contents of text files. Usage:

FC [Options] File path 1 File path 2

This command is used to compare the contents of files, and then shows the differences between the contents, supporting the comparison of files across disk partitions. Multiple options are provided at the same time. You can use fc/? Or “Help FC” to see the instructions for the options.

  • FIND — Search for file contents

“FIND”, which means to FIND, is used to search for a specified string in the contents of a specified file and display the corresponding results. This is equivalent to finding the content. Usage:

FIND [option] “string” [file path]

This command is used to search for a string. The string to be searched must be generated by the English state “” “, and the string must be a mandatory parameter. The file path is not required, but most of the time the content string is searched from the existing file, and if the file path does not exist it will be searched from the next input (press CTRL+C to terminate the search). This command supports cross-partition operations.

By default, finding the specified string in the content prints out the entire line of content that exists in that string. Of course, it also provides rich option control, using “find/?” Or “Help find” to view all options, where the “/V” option displays the output line that does not contain the search string; The “/C” option prints the number of lines containing the search string; The /N option displays the line number and content containing the string. The “/L” option allows you to specify a strict case-sensitive string for search, which is case-insensitive by default. Of course, these options can be used in combination to achieve different effects.

  • FINDSTR — File content search

“FINDSTR” means to FIND a string. The function of this command is similar to that of the “FIND” command. Of course, the FINDSTR command is more complex than the FIND command, and it allows you to search all files in a directory. Usage:

FINDSTR [options] string [file path]

This command, like the “FIND” command, is used to search for a string in a file and print the corresponding result. The string to be searched can be raised by the English state “” “, or it can not be used, but the string must be specified. The file path is the same as the FIND command. If the file path is not specified, the system searches for the file in the next input. This command supports cross-partition operations.

You can use the FINDSTR command to search multiple strings. Multiple strings must be separated by Spaces, and strings must be generated with “”. Otherwise, the string is interpreted as a command option. FINDSTR also supports extended searches of expressions, string ranges, and more. You can use FINDSTR /? Or “Help findstr” to see specific instructions.

As with the “FIND” command, by default, finding the specified string in the content prints out the entire line of content that exists in that string. Of course, it also provides rich option control, using “findstr/?” Or “Help Findstr” to see all options, where the “/I” option specifies that the search process is case-insensitive, which is strictly case-sensitive by default; The “/X” option filters out exactly matching lines and displays the output. The usage is flexible, you can try combinations of options, so as to achieve different effects.

4.4. Ms-dos system management
  • PATH – Performs PATH management

The “PATH” command is a key command, but it is not used much. This command is used to set the PATH constant value in the MS-DOS environment variable, that is, the PATH variable in the MS-DOS execution environment variable. Usage:

PATH [destination directory PATH][;…] [;%PATH%]

PATH is an executable PATH in MS-DOS. If the PATH is specified, the following resources can be searched from the executable directory specified by PATH. This is flexible.

The “PATH” command that does not specify “target directory” is used to view the “PATH” environment variable in the current system registry. When the target directory is specified, the PATH environment variable in the current MS-DOS environment is changed to the specified directory. Of course, multiple directories can be included. Use; Segmentation; If you want to append a directory to the existing “PATH” environment variable, you can use “%PATH%” to reference the existing environment variable (this usage is actually a reference to the variable).

  • DATE – DATE management

DATE indicates the DATE. This command is used to manage system DATE information. Enter the “DATE” command without parameters to display the current DATE and prompt you to change the new DATE. Use the “/T” option to cancel the modification step and output only the current date. The “DATE” command with a DATE value is used to change the current DATE to a specified DATE.

  • TIME — TIME management

“TIME” indicates the TIME. Like “DATE”, this command is used to manage system TIME. Enter the “TIME” command without parameters to display the current TIME and prompt you to change the new TIME. Use the “/T” option to cancel the modification step and output the current time. You can run the “TIME” command with a TIME value as a parameter to change the current TIME to a specified TIME.

  • CLS – CLS

The CLS command is used to clear the current screen content. If the screen has a lot of content, run the CLS command to clear all content on the screen and return to the working path before the command is executed.

  • EXIT, EXIT

“EXIT” means EXIT. This command is used to EXIT the current command line program. Note that you can end only one command line program, not all of them. The command line window is closed. Advanced applications can use exit/? And “Help Eixt” to view.

  • HELP — HELP view

“HELP” means HELP, as mentioned above, and is mainly used to output command line HELP information. It can be used in two ways: to print a list of all mS-DOS command line command description information, and to view instructions for individual commands. Use mode:

HELP [command]

This command is used to help view documentation documents. In most cases, mS-DOS commands provide “/? Option to achieve the same effect.

4.5. Disk Management
  • Format — Format a disk

“Format” is a disk formatting tool provided by Windows. To “format” is to erase all data on a disk. The WINDOWS\system32\format.com tool is a command line tool. Using this tool, you must specify the volume label of the disk partition (also known as the drive name). Formatting is a dangerous operation and should not be used lightly.

The format command also provides a wealth of options. You can use the format/? Or Help format. You can format a disk partition and change its file system format and volume label name at the same time. A commonly used method is to quickly format the format drive letter /Q. This method can quickly format the file system and retain the original file system format.

  • Convert – Disk format conversion

Convert is a conversion tool for disk file systems provided by Windows. The so-called “file systems” refer to disk partition formats such as FAT, FAT32, AND NTFS. The WINDOWS\ System32\ convert.exe tool is a command line tool. To use the tool, you must specify the volume label of the disk partition (the drive letter to convert) and specify the “/FS:NTFS” option. That is, the tool can only convert disks of other formats to NTFS format.

The “convert” command also provides a rich set of options, using the “convert/? Or “help convert”. This conversion does not erase the disk’s original data, but merely reconstructs its file system. The most commonly used mode is convert drive letter /FS:NTFS, which converts the specified disk to NTFS format. Note that conversion cannot be performed on the current working partition.

  • CHKNTFS — Disk check Settings at startup (self-check Settings)

“CHKNTFS” is a disk check setup tool provided by Windows, the so-called “disk check” is what we call “self-check”, still for the abnormal shutdown caused by the system in the next startup is blue screen of self-check and trouble? Ha ha… Use the “CHKNTFS” tool to cancel the disk self-check process for you. When using this command, you must specify the disk partition volume (drive letter) to be operated. It is verified that the tool can effectively set only NTFS disks.

The “CHKNTFS” command also provides rich options. You can use the “CHKNTFS /? Or “help CHKNTFS”, perhaps this command is useful for us to cancel the disk self-check process. The command to cancel is as follows:

 

12 chkntfs ``/t``:0`` chkntfs ``/x D:

The preceding command sets the count time for starting the self-check to 0, and then forcibly cancels the self-check for drive D. To cancel the self-check of other partitions, change the value of D: to the corresponding volume label.

 

4.6. Other common external commands
  • Ping — TCP/IP remote connection test

“PING” command, have done programming should know this command, as for TCP/IP is enigmatic, here do not do more introduction, you can go to check the relevant information, beginners know it is to support the Internet thing on the line. The ping command is used to test the network connection between the remote host and the target host. Usage:

PING [option] Destination host address

This command is used to test the network connection with the target host. Therefore, the address of the target host must be specified. Usually, an IP address is used to represent a computer on the network.

If you are unable to access the Internet, you will be told to “see if you can ping”. This means that you can use the “ping” command provided by TCP/IP to check whether the network is normal. When we see the result of “Request timed out.”, it means that the target host cannot be connected to the network. XXX: bytes=xx time= XXMS TTL=xx “is displayed. In other words, the network connection to the target host is normal.

The PING command provides various command options. You can run the PING /? To view all of its options and descriptions.

  • Ipconfig — View TCP/IP information

The “IPCONFIG” command is known to all programmers. This command is used to view the IP configuration information of the local computer. The usage is simple:

IPCONFIG [option]

This command is used to view the IP address and gateway of the current network connection.

In general, you can view the local IP address based on the properties of the network connection, but there is nothing you can do about the machine that automatically obtains the network address. Ha ha… We can use the “ipconfig” command to check. The “ipconfig” command provides multiple operations. You can use the “ipconfig/? By default, you can run the ipconfig command to view the IP address, subnet mask, and gateway information of the current open network connection. You can use the /all option to view the complete local network information, including the host name, MAC address, IP address, subnet mask, gateway, and DNS server.

  • Net – network environment, services, users and other comprehensive management

NET is a Comprehensive Windows management tool. It can be used to manage most important Windows function modules, such as network environment, services, users, and logins. It also supports remote computer management. The “net” command is a combined command. You can use “net” or “net/?”. To view all the combinations of the command.

For me, the most commonly used is its service management. You can use the combination of “net” command and “start” command to start the service, and the combination of “stop” command to stop the service. The usage is as follows:

 

12 net start servername``net stop servername

Note: The service name can be viewed in the service options module.

  • Netstat – View network connection information

NETSTAT is a tool provided by the TCP/IP module to view network statistics and current network connection information. In fact, in the process of programming development, it is necessary to know the “netstat” command, especially in the Web development, we can use the “netstat” command to check the port usage. The usage is simple:

NETSTAT [options]

Generally, the “netstat” command without options is used to view the TCP connection status of the local host. The result is a list of the mapping addresses and status information between the local host and the connected host. In fact, for me useful basic is to use it to check the “port number occupation”. This command provides a variety of options. You can use the netstat/? The /a or -a option is used to view all connections and port listening of the current host, including TCP and UDP. The /b or -b option allows you to view the full path name of the executable component for each connection or listening port. The /n or -n option forces the information to be displayed in digital mode, that is, IP address and digital port.

  • Telnet – Remote connection

TELNET is a network client tool provided by the TCP/IP module. You can use this tool to log in to remote hosts on the network. The command line tool is more powerful, can realize the packet sent to accept, ha ha… It’s really powerful, so I don’t know how to use it, but of course you can study it. I’ve seen an example of using the “Telnet” command to simulate HTTP access to a remote host and print out the HTML code for the front page of a site. Use the following methods to log in to a remote host over Telnet:

 

 

1 telnet ``hostname port

Hostname indicates the unique identifier of a host, which can be an IP address or domain name. Port indicates the port number. The default value is 23.

  • MSG — Message sending

“MSG” is a network message sending client tool provided by THE TCP/IP module. You can use the “MSG” command to realize the message transmission function on the network, but of course, it cannot realize too complex message transmission. The usage is relatively simple:

MSG Target user [option] message

In simulation, the “target user” usually refers to the local user name or, of course, the user name of the remote host. For example, if you use MSG * 123 to send message 123 to all local users, local users can read the message in the dialog box that is displayed.

  • Tasklist – System process view

TASKLIST is a process monitoring tool provided by Windows. The tool displays a list of tasks or processes running on the local or remote host system. This is the same as the list of process options in the Task Manager on Windows, except that the taskList command does not refresh by default. By default, the tasklist command is used to display the names, ids, and memory usage of all processes at the current time. Of course, there are multiple options available, such as “tasklist/? To look at it.

  • Taskkill — System process terminates

“TASKKILL” is a process management tool provided by Windows. This tool is very familiar with “TaskList” tool, but has different functions. The “taskkill” command can end at least one process with a specified ID or name on the local or remote host. You can use the taskkill/? To look at it.

Note that Windwos also provides a process management tool called TSKILL, which is different from taskill. You need to specify a process ID or process name when using TSKILL. Tasklist allows you to view the process ID and process name. Therefore, it must be used together with the “tasklist” command.

4.7. Running commands of common programs
  • Edit – Text editor (the most basic DOS-level text editor)
  • Nslookup – Domain name and DNS detection tool (can check the IP address of the specified domain name)
  • Shutdown – The computer shuts down, logs out, and restarts the command line tool
  • Regsvr32 – System DLL component management tool
  • Calc — Calculator program
  • Clipbrd – System clipboard management tool
  • Dxdiag — DirectX information check tool
  • Gpedit. MSC — Group Policy Management panel
  • Notepad — Notepad program
  • Regedit – Registry editor
  • Services. MSC – Service manager
  • Control — Control panel
  • Taskmgr — Task Manager
  • Sysdm. CPL — System Properties (My Computer — Properties Panel)
  • Write – Tablet program
  • Winmsd — System information viewing panel (System, hardware, software environment provided by Windows)
  • Winword — Create Office Word (must install Office software)
  • Excel — Create new Office Excel (Office software must be installed)
  • Powerpnt — New Office PowerPoint (Office must be installed)

Dir is used to display files and subdirectories in a directory

cd.. Returns the upper directory

Md creates a subdirectory

Rd To delete a directory, the directory must be empty

CD xx Go to the next-level directory xx

Del Deletes one or a group of files on a specified disk or directory. This command cannot delete files with read-only, implicit, or system attributes. If the specified file does not exist, “Filenotfound” is displayed. DOS can use UNDELETE external command to recover files that have been deleted by mistake. It can only delete files, not directories.

Ren Changes the name format of a file or a group of files on a specified disk or directory eg: ren xxx.txt xx.txt

Type Displays the content format of the specified file eg: type xxx.txt

Format Disk formatting

Mem looks at your computer’s memory and usage

CHKDSK Checks the disk usage

CLS clears the contents of the monitor screen, bringing the DOS prompt to the upper left corner of the screen

Time Sets the computer display time

Date Displays and sets the system date

[form] date/MM DD – YY

Ver Displays the operating system DOC system version

To view the local IP: Run -> Enter command and press Enter ipconfig

Afterword.

In fact, DOS under the command more than the above introduction, personal experience is limited, only listed their own know more commonly used DOS commands, for other commands I hope we actively supplement.

 

To be skilled, to be warm, the harder you work, the luckier you will be. Don’t let those who have paid for me down —–Angel_Kitty

Please indicate:www.cnblogs.com/ECJTUACM-87…