Cmd.exe more complex and powerful command line parameters

Source: Internet
Author: User
Tags control characters
Cmd.exe has many command line parameters as follows:
CMD [/A |/u] [/q] [/d] [/E: On |/E: Off] [/F: On |/F: off] [/V: On |/V: Off] [
[/S] [/c |/K] string]
/C executes the specified command of the string and then interrupts it;
/K executes the specified string command but retains it;
/S modifies string processing after/C or/K;
/Q close the response;
/D stop executing the autorun command from the registry;
/A converts the output from an internal pipeline or file command to ANSI;
/U converts the output to an internal pipeline or file command to Unicode
/T: FG sets the foreground/background color (for details, see color /?);
/E: Enable command extension on;
/E: off stop command extension;
/F: Enable file and directory name completion characters on;
/F: off stop file and directory name completion character;
/V: On uses C as the separator to start the extension of delayed environment variables.
/V: Off disables delayed environment extension.
Note that if the string contains quotation marks, you can use multiple commands separated by the command separator. In addition, for compatibility reasons,/X is the same as/E: On,/Y is the same as/E: off, And/r is the same as/C. Ignore any other Command Options.
If/C or/K is specified, the remaining part of the command line after the command option is processed as the command line. In this case, the following logic is used to process the quotation mark ("):
(1) If all of the following conditions are met, the quotation marks on the command line will be retained:
Without the/s command option;
There are two full quotation marks;
There is no special character between two quotation marks, and the special character is one of the following: <> () @ ^ |;
There must be at least one blank character between two quotation marks;
There is at least one executable file name between two quotation marks.
(2) otherwise, the old method is to check whether the first character is a pair of quotation marks. If so, remove the first character and delete the last pair of quotation marks on the command line, retain the text after the last quote character. If/D is not specified on the command line, when cmd. EXE starts, it will look for the following REG_SZ/reg_expand_sz registry variable. If one or both of these variables exist, the two variables are executed first.
HKEY_LOCAL_MACHINE/software/Microsoft/command processor/Autorun
And
HKEY_CURRENT_USER/software/Microsoft/command processor/Autorun
Command extension is enabled by default. You can also use/E: off to disable the extension for a specific call. You can enable or disable all the called extensions of regedit32.exe on the user's website. Therefore, you must use one or two REG_DWORD values in the registry of regedit32.exe:
HKEY_LOCAL_MACHINE/software/Microsoft/command processor/enableextensions
And
HKEY_CURRENT_USER/software/Microsoft/command processor/enableextensions to 0x1 or 0x
0. User-specific settings have priority over machine settings. Command Line Command Options have priority over registry settings.
Command line extensions include changes and additions to the following commands:
Del or erase, color, CD or chdir, MD or mkdir, prompt, pushd, popd, set, setlocal, end local, if, for, call, shift, Goto, start including changes made to external command calls), as SOC, FTYPE.
For more information, type "HELP command name ".
Environment extension of delayed variables is not enabled by default. You can use the/V: On or/V: off Command Option to enable or disable extended environment variables for a cmd. EXE call. You can enable or disable all the calls of CMD. exeon the machine or user login session. This requires that you use one or two REG_DWORD in the registry of regedit32.exe.
Value:
HKEY_LOCAL_MACHINE/software/Microsoft/command processor/delayedexpansion
And
HKEY_CURRENT_USER/software/Microsoft/command processor/delayedexpansion to 0 X1 or 0x0. User-specific settings have priority over machine settings. Command Line Command Options have priority over registry settings.
If the extension of the delayed environment variable is enabled, the exclamation point character can be used to replace the value of an environment variable at the execution time.
The file and directory names are disabled by default. You can use the/F: On or/F: offcommand to enable or disable a file name for a call of cmd.exe. You can enable or disable all the calls of "regedit32.exe" on the machine or the user's website. You must set one or two REG_DWORD values in the registry of regedit32.exe:
HKEY_LOCAL_MACHINE/software/Microsoft/command processor/completionchar
HKEY_LOCAL_MACHINE/software/Microsoft/command processor/pathcompletionchar
And
HKEY_CURRENT_USER/software/Microsoft/command processor/completionchar
HKEY_CURRENT_USER/software/Microsoft/command processor/pathcompletionchar
The hexadecimal value of a control character is used as a specific parameter (for example, 0x4 is Ctrl-D, 0x6 is Ctrl-f). user-specific settings take precedence over machine settings. The command line option takes precedence over registry settings.
If the command/F: On is enabled, use ctrl-D for the directory name and Ctrl-F for the file name. To disable a character in the registry, use a space (0x20) value because it is not a control character.
If you type one of the two control characters, the completion is called. After the completion of the function, the path character is long on the left side of the cursor. If no wildcard is available, the wildcard is appended to the left side and a list of matched paths is created. Then, the first matching path is displayed. If no matching path exists, a beep will be made without affecting the display. Then, repeat the same control character to display a list of consistent paths cyclically. Press the Shift key and control character at the same time, and the list is displayed backwards. If you edit the row and press the control character again, the list of saved paths will be discarded and the new one will be generated. If the command option is executed between the file and the directory name, the same occurs. The only difference between the two control characters is that the file completion character matches the file and directory name, while the directory completion character only matches the directory name. If the file is used for built-in directory commands (Cd, MD, or RD), the directory is used.
Enclose the quotation marks in a consistent path. After the code is completed, the file name containing spaces or other special characters can be correctly processed. At the same time, if the backup is completed and the file is called in the row, the text on the right of the cursor is discarded.
Editor's note: I 've talked so much about it. I mainly introduced Microsoft's command extension and Path Extension in principle.
The functions to be completed are interesting and practical for most of our computer hobbies.
: // Www.microsoft.com the query results show that Windows has the same command line auto-completion function as Linux since Windows NT 4.0. Do not believe that HKEY_LOCAL_MACHINE/software/Microsoft/comma
Change the key value of Nd prosessor/completionchar to 9, switch to the command line window, enter cd c:/wind, and press a tab to try it ...... The system automatically enters cd c:/Windows for you.
8. An interesting bug
In the command line (even in other graphic editor such as Word2000 !) After any Chinese input method is called, (You can press SHIFT + ^ to directly input from the keyboard), then enter any uppercase English letter or press shift to enter some special characters, then a "…" will be automatically added after each character Number, such as "W ..." , "% ..." I don't know what Microsoft's intention is to do this? I can't think of the usefulness of this function. It can only be interpreted as an insignificant bug.
As can be seen from the above, the traditional DOS is not completely abandoned in the Win2000 era, but is carried forward. It has been transformed from a dominant operating system in history to an integral part of the Win2000 operating system. Having the power of webshell has its own unique charm compared with the graphic interface. We should not forget "Old dos", let alone understanding and using command line operations. In many cases, a complicated operation can be completed quickly and well with command lines, why is it necessary to find (or even develop) A dedicated graphical interface tool?

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.