CMD start a new instance of command interpreter Cmd.exe _dos/bat

Source: Internet
Author: User

Cmd
Starts a new instance of the command interpreter Cmd.exe. If used without parameters, CMD displays the version and copyright information for Windows XP.

Grammar
cmd [[{/c|/k}] [/s] [/q] [/d] [{/a|/u}] [/T:FG] [/e:{on|off}] [/f:{on|off}] [/v:{on|off}] string]

Parameters
/C
Executes the command specified by string, and then stops.
/k
Executes the command specified by string and continues.
/s
Modify string processing after/C or/k.
/q
Turn off Echo.
/d
Disables autorun command execution.
/A
Create the American National Standards Association (ANSI) output.
/u
Creates a Unicode output.
/t:fg
Sets the color of foreground f and background G. The following table lists valid hexadecimal digits that can be used as values for f and G. Value Color
0 Black
1 Blue
2 Green
3 Lake Blues
4 Red
5 Purple
6 Yellow
7 White
8 Grey
9 Light Blue
A Light Green
B Shallow Water Green
C Light Red
D Light Purple
E Light Yellow
F Bright White

/e:on
Enable Command extensions.
/e:off
Disables command extensions.
/f:on
Enable file and directory name completion.
/f:off
Disable file and directory name completion.
/v:on
Enables deferred environment variable extensions.
/v:off
Disables the deferred environment variable extension.
String
Specifies the command to execute.
/?
Display Help at the command prompt.
Comments
Using multiple commands
You can use multiple commands separated by && in string, but these commands must be enclosed in quotation marks (for example, "Command&&command&&command").

Working with quotes
If either/C or/k is specified, CMD handles the remaining commands in string and retains the quotation marks if all of the following conditions are true:

The/s is not used.
Use a pair of quotes correctly.
No special characters are used within quotation marks (for example, &<> () @ ^ |}.
One or more empty grid characters are used within quotation marks.
The string within the quotation marks is the name of the executable file.
If the above conditions are not met, then the first character of the string is checked first to verify that it is a left quotation mark. If the first character is a left quotation mark, it is separated from the closing quotation mark. Any text that follows the closing quotation marks is preserved.

Execute registry subkey
If/d,cmd.exe is not specified in string, the following registry subkey is found:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command PROCESSOR\AUTORUN\REG_SZ

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\autorun REG_EXPAND_SZ

If one of these registry subkeys or two are present, they are executed before other variables are executed.

Warning

Improper editing of the registry can severely damage your system. Before you change the registry, you should back up any valuable data on your computer.
Enabling and Disabling command extensions
In Windows XP, command Extensions are enabled by default. For specific procedures, you can use/e:off to disable them. You can enable or disable extensions for all cmd command-line options on your computer or in a user's session by setting the following REG_DWORD values:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\enableextensions\reg_dword

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\enableextensions\reg_dword

Use Regedit.exe in the registry to set the REG_DWORD value to 0x1 (that is, enabled) or 0x0 (that is, disabled). User-specific settings take precedence over computer settings, and command line options take precedence over registry settings.

Warning

Improper editing of the registry can severely damage your system. Before you change the registry, you should back up any valuable data on your computer.
When command extensions are enabled, the following commands are affected:

Assoc
Call
ChDir (CD)
Color
Del (Erase)
Endlocal
For
Ftype
Goto
If
MKDIR (MD)
popd
Prompt
pushd
Set
Setlocal
Shift
Start (also includes changes to external command procedures)

For more information about these commands, see.

Enabling deferred environment variable extensions
Enabling deferred environment variable extensions, you can use an exclamation point to override the RUN-TIME environment variable value.

Enable file and directory name completion
By default, file and directory name completion is disabled. For specific cmd command processing, you can enable or disable this feature by/f:{on|off}. You can enable or disable the completion of file and directory names that are processed by all CMD commands on your computer or in a user session by setting the following REG_DWORD values:

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\completionchar\reg_dword

HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\pathcompletionchar\reg_dword

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\completionchar\reg_dword

HKEY_CURRENT_USER\Software\Microsoft\Command Processor\pathcompletionchar\reg_dword

To set the REG_DWORD value, run Regedit.exe and use the hexadecimal value of the control character for the specific feature (for example, the TAB key is represented by 0x9, and the BACKSPACE key is represented by 0x08). User-specific settings take precedence over computer settings, and command line options take precedence over registry settings.

Warning

Improper editing of the registry can severely damage your system. Before you change the registry, you should back up any valuable data on your computer.
If you have enabled file and directory name completion with/f:on, you can use the Ctrl+d key combination for the directory name completion, and for the file name completion, you can use the CTRL+F key combination. To disable completion of a specific character in the registry, use the space value [0x20], because the space is not a valid control character.

When you press Ctrl+d or ctrl+f keys, CMD handles the completion of file and directory names. The key combinations are to append a wildcard character (if not used) after a string, create a matching list of paths, and then display the first matching path. If all paths do not match, the file and directory name completion will emit a warning sound and do not change the displayed content. To view the paths in the matching path list one by one, repeat the ctrl+d or ctrl+f key combination. To view the list back, press SHIFT while pressing CTRL+D or the CTRL+F key combination. To discard a saved list of matching paths and generate a new list, you can edit the string and press Ctrl+d or CTRL+F to combine the keys. If you switch between the ctrl+d and ctrl+f key combinations, the saved list of matching paths is discarded and a new list is generated. The only difference between a ctrl+d key and a ctrl+f combination is that ctrl+d matches only the directory name, and ctrl+f matches both the file name and the directory name. If the completion of file and directory names is used in any internal directory command (CD, MD, or RD), only the completion of the directory is used.

If you enclose a matching path in quotation marks, the completion of file and directory names will correctly handle file names that contain spaces or special characters.

The following special characters need to be quoted:& < > [] {} ^ =;! ' +, ' ~ [White]

If the information you provide contains spaces, enclose the text in quotation marks (for example, "Computer Name").

If you work with file and directory names from string, any part of [Path] that is located to the right of the cursor will be discarded (that is, where the completed operation is handled in string).

XOX

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.