CMD
(from Command)
Starts a new instance of the Windows command interpreter (CMD.EXE
).
CMD [/A | /U] [/Q] [/D] [/T:fg][/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF] [[/S] [/C | /K] string]
Where:
/C
- Executes the command specified by the string, then terminates./K
- Executes the command specified by the string and remains./S
- Changes the treatment of the specified string after/C
or/K
(does not preserve quotes)./Q
- DisablesECHO
(hides subsequent commands and the current directory, see ECHOECHO)./D
- Disables running AutoRun commands from the registry./A
- Outputs internal commands to pipes or files in ANSI format./U
- Outputs internal commands to pipes or files in Unicode format./T:fg
- Sets text and background colors (see COLORCOLOR)./E:ON
- Enables command extensions (recommended if they are disabled, enabled by default)./E:OFF
- Disables command extensions (not recommended)./F:ON
- Enables directory and file name completion characters./F:OFF
- Disables directory and file name completion characters (disabled by default)./V:ON
- Enables delayed expansion of environment variables using!
as delimiter (example:!PATH!
)./V:OF
- Disables delayed environment expansion (disabled by default).string
- Specifies the command or commands to execute. If the string contains spaces or special characters, quotes are required. For multiple commands, use&&
to join them (example:ECHO OFF && CLS
).
Analogous options:
/X
- Similar to/E:ON
./Y
- Similar to/E:OFF
./R
- Similar to/C
.
Examples:
1. Start a new instance of the command prompt by turning off ECHO
and running the command ATTRIB +H C:\Omfg!!.txt
, then exits (see ATTRIBATTRIB):
cmd /q /c "attrib +h C:\Omfg!!.txt"
2. Start a new instance of the command prompt by setting the text colors to blue and the background to white and running the CLS
command, then remains (see CLSCLS):
cmd /t:f9 /k cls
Comments