Starts a new instance of the NT command interpreter.
A command interpreter is a program that lets you type commands. Use the EXIT command to stop the new command interpreter and return control to the old one.
CMD /?
CMD [/A | /U] [/D] [/F:ON | /F:OFF] [/Q] [/T:fg] [/V:ON | /V:OFF] [[/X | /E:ON] | [/E:OFF | /Y]] [[/S] [/C command] | [/K command]]
none.
EXIT - Use this to close a CMD
shell and return.
CALL - Call one batch program
from another
START - Start a separate window to run a
specified program or command
DOSKEY Edit command-line, recall commands
Equivalent Linux BASH commands:
builtin - Run a shell builtin
bash - run the bash shell
chroot - Run a command with a different root directory
csh - run the C shell
exec - Execute a command
ksh - run the Korn shell
sh - run the Bourne shell
CMD.exe is the NT equivalent of Command.com in previous operating systems. The older 16-bit command processor command.com is supplied to provide backward compatibility for 16-bit DOS applications.
To ensure that an NT batch file will not run if accidentally copied to a Windows 95/98/ME machine you should use the extension .CMD rather than .BAT.
The %COMSPEC% environment variable will show if you are running CMD.EXE or command.com.
It is possible to run the Windows 2000 CMD.EXE under NT 4.0.
The environment Variable %CMDCMDLINE% will expand into the original command-line passed to CMD.EXE.
Under Windows NT, the command-line is limited to 256 characters. The command processor was patched from NT 4 Service Pack 4 to prevent this limitation from causing a stack overflow.
Multiple commands separated by the command separator '&&' are accepted if surrounded by quotes.
This logic is used to process quote (") characters:
The key combination ALT-ENTER will switch a CMD window to full-screen mode. Press ALT-ENTER again to return to a normal Window.
Missing the /Y option of COMMAND.COM to step through (debug) a batch file line by line? Here is a replacement:
@ECHO OFF :: uses rlCmd.bat, %%rlCmd%%, :rlCmdY :: 2004Jan31 Rick Lively :: 2004Feb03 add comspec option :: IF EXIST rlCmd.bat GOTO :rlCmd10 IF /%1==/ GOTO :rlCmd30 IF EXIST %1.bat ( CALL %0 %1.bat GOTO :EOF ) IF EXIST %1.cmd ( CALL %0 %1.cmd GOTO :EOF ) IF NOT EXIST %1 GOTO :rlCmd20 SET rlCmd= ECHO @ECHO OFF>rlCmd.bat FOR /F "tokens=* " %%F IN (%1) DO ( ECHO CALL %0 %%F>>rlCmd.bat ECHO %%rlCmd%% GOTO :rlCmdY>>rlCmd.bat ECHO %%F>>rlCmd.bat ECHO :rlCmdY>>rlCmd.bat ) CALL rlCmd.bat ERASE rlCmd.bat SET rlCmd= GOTO :EOF :rlCmd10 SET rlCmd=y SET /P rlCmd=%time% %* [Yncq]? IF /%rlCmd%==/C SET rlCmd=c IF /%rlCmd%==/c ( %COMSPEC% /K PROMPT=$T $P$_rlCmdY$G GOTO :rlCmd10 ) IF /%rlCmd%==/Y SET rlCmd=y IF /%rlCmd%==/Q SET rlCmd=q IF NOT /%rlCmd%==/y IF NOT /%rlCmd%==/q ( IF NOT /%rlCmd%==/N IF NOT /%rlCmd%==/n GOTO :rlCmd10 SET rlCmd= ) IF /%rlCmd%==/y SET rlCmd=:: IF /%rlCmd%==/q SET rlCmd=GOTO :EOF GOTO :EOF :rlCmd20 ECHO. ECHO file '%1' '%1.bat' '%1.cmd' NOT found :rlCmd30 ECHO. ECHO To step through (2K or XP) NT batch file: Test ECHO prompts: [Yncq] Yes, No, Comspec, Quit ECHO. ECHO %0 Test ECHO OR %0 Test.bat ECHO OR %0 Test.cmd GOTO :EOF
none.