Windows 7 / Getting Started

Extended Commands

CMD's built-in commands are a superset of the ones recognized by the old COMMAND.COM shell, and many have been extended with new features. The command extensions are enabled by default in Windows 7,Vista, and XP, although they can be disabled if necessary. Table below lists the extended commands and their added features. If the extensions cause problems for you-for example, if you have to use old batch files that do not work with the new command versions and you cannot update them-you can start CMD with the extensions disabled. I discuss this in the section "Running CMD."

Commands Modified by Command Extensions
CommandFeatures Added by Command Extensions
assocOnly available with extensions enabled.
callcall :label
Argument substitution modifiers (for example, %~f1).
cd / chdirOption /D changes current drive.
The current directory uses the directory's actual upper/lowercase.
colorOnly available with extensions enabled.
dateOption /T prints the date without prompting for a new date.
del / eraseOption /S displays names of files being deleted.
endlocalRestores EXTENSIONS and DELAYEXPANSION settings.
ftypeOnly available with extensions enabled.
gotogoto :EOF
if...else/I, IF CMDEXTVERSION, IF DEFINED Comparisons such as LEQ.
md / mkdirCreates intermediate directories if necessary.
prompt$+ and $M options.
pushd / popdAccepts a network path and maps a drive letter.
set/A and /P options. The set command with a partial name displays matching names.
setlocalENABLE... and DISABLE... arguments.
shift/n option.
startStarts nonexecutable files via file extensions. Uses PATHEXT expansion. Doesn't wait for Win32 commands to exit before prompting again. Uses the COMSPEC path when the command is CMD. Runs Explorer if the command is a folder name.
timeOption /T prints the time without prompting for a new time.

In the next few sections, some additional detail on some of the more important commands.

[Previous] [Contents] [Next]