"+" Is a wonderful use in the DOS command

Source: Internet
Author: User

When you enter the + path command at the DOS prompt c: \, what do you think will happen? Is it bad command or filename? Or show the path? You may say it is the former or the latter, but you will not think that the result is that it is inexplicably changing the path to Path = H. But this is exactly the case, this is the result of an incorrect + path command on the machine. After excluding the virus, I found that this "+" played an extraordinary role in the use of DOS. The DOS command interpreter command. com used the + path command as Path = H for execution. Since path is an Internal DOS command, I thought about whether other Internal DOS commands have similar phenomena. One by one, the following results are amazing.

When you enter the + MD command at the prompt, it will create a subdirectory named D in the current directory, + CD can enter this subdirectory, and then return to the parent directory, enter + rd to delete the d directory (assuming there are no new subdirectories or files under this directory). Note that h and D are exactly path, MD, CD, the last letter of RD, and then input + mkdir, which creates an R sub-directory. + chdir and + rmdir can also enter and delete the r sub-directories respectively. So I suddenly realized that when dos added a "+" before processing internal commands, it regarded the last letter of the command as the command option.

Since DOS has this function, the results of the following commands are taken for granted.

+ DIR is the same as dir R. Of course, + Dir, (note that this "," cannot be lost.) This command will not release hidden R files or subdirectories.

+ Copy l can copy a file named Y and name it L. + copy con can display the file on the screen. Since the y file can be operated, how can I implement these operations when there is a y. txt file? We can boldly enter such a command + copy. txt con. What is the result? Successful!

+ Type can display the content of the E file in the current directory. Of course, e can also contain extensions such as TXT. For example, + type. txt more.

In this way, the "+" feature has been extended. We can define this special command format as follows:

+ For internal commands, select the appropriate delimiter, select the appropriate string, and select the required Command Options 〗. Separators vary depending on commands. For example, a path can accept "", "", "/" "\", ":", ";", and ". and cannot accept characters such as "{", "}", "<", ">", and. For example, we can define the path: + path; C: \ DOS; C: \ UCDOS; C: \ windows, and the result will generate Path = H; C: \ DOS; c: \ UCDOS; C: \ windows.

There are several special commands, such as del (or delete, erase) and Ren (or rename). When a "+" is added before them, they treat L (or E), n (or E) as sub-directories separately and are not appropriate.Composition. + The del command is used to delete all files in the L subdirectory of the current directory after confirmation, or partially delete the files, such as + Del \*. TXT. If the L sub-directory does not exist (it does not check whether there are L files in the current directory), the path not found, similar to, Ren (or rename) is displayed) you can only change the name of a specified file in the N (or E) subdirectory, but cannot change the name of the N (or E) file in the current directory, for example, + Ren/. wps B. WPS.

In addition to the file operation commands of DOS, there are also a type of commands such as break, date, time, Ver, vol, etc. Adding a "+" before them can also execute the command, but it does not seem to make much sense. For example, must specify on or off is displayed when + break is input, because it runs this command as break = K. When the input is + date, It is shown as follows: invalid, and then enter new date. It regards e as the new date you entered! When the input is + vol and + ver, an error occurs.

There is also a special CLS command. Because CLs and CLS have the same execution results, + CLS can also be used to clear the screen, just a little more explicit.

Since adding "+" in front of the dos internal command can play such a role, what about other symbols? After my experiments, I found that the colon (":") can also play the same role, that is, it can also be added before the dos internal command to make the last character of the command as the command parameter. "+" In all the above commands can be replaced by ":", which is not described here.

in fact, sometimes adding two symbols to a DOS command plays an extraordinary role, such as Dir, (displaying hidden files and subdirectories), and attrib, (cancel all attributes of all files in the current directory. Note: These two "," cannot be lost.) If you are careful when running the computer, it is not difficult to find these dos secrets.

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.