Open main menu
Home
Random
Recent changes
Special pages
Community portal
Preferences
About Wikipedia
Disclaimers
Incubator escapee wiki
Search
User menu
Talk
Dark mode
Contributions
Create account
Log in
Editing
Cmd.exe
(section)
Warning:
You are not logged in. Your IP address will be publicly visible if you make any edits. If you
log in
or
create an account
, your edits will be attributed to your username, along with other benefits.
Anti-spam check. Do
not
fill this in!
==Use== ===Desktop integration=== In Windows, the shell is presented in the [[Windows Desktop|desktop]] via [[Windows Terminal]] or on older versions via [[Windows Console]]. ===Concurrent piping=== In OS/2 and Windows, the shell supports [[Pipeline (Unix)|pipes]] to allow both sides of a pipeline to run concurrently. As a result, it is possible to redirect the [[standard error stream]]. In contrast, {{mono|COMMAND.COM}} uses temporary files, and runs the two sides serially, one after the other. ===Command separator=== Multiple commands can be included in a single line using the command separator {{code|&}} or {{code|&&}}.<ref name="docs.microsoft.com">{{Cite web|url=https://docs.microsoft.com/en-us/windows-server/administration/windows-commands/cmd|title=cmd|website=Microsoft Learn |date=September 12, 2023 |url-status=live |archive-url=https://web.archive.org/web/20231121065635/https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/cmd |archive-date=November 21, 2023}}</ref> With the {{code|&}} separator, a subsequent command is executed even if the previous command indicates an error.<ref>{{Cite web|title=Command Redirection, Pipes - Windows CMD - SS64.com|url=https://ss64.com/nt/syntax-redirection.html|access-date=2021-09-23|website=ss64.com}}</ref> In the following example, each of the three commands is executed, one after the other, and regardless of their result code. <syntaxhighlight lang="doscon"> >CommandA & CommandB & CommandC </syntaxhighlight> With the {{code|&&}} separator, a command must complete successfully for the subsequent command to execute. In the following example, {{code|CommandB}} only executes if {{code|CommandA}} completes successfully, and {{code|CommandC}} only executes if {{code|CommandB}} also completes successfully. <syntaxhighlight lang="doscon"> >CommandA && CommandB && CommandC </syntaxhighlight> ===Command line limit=== The shell limits the length of a command line which includes entered text, individual [[environment variable]]s that are inherited by other [[process (computing)|processes]], and all environment variable expansions<ref>[https://support.microsoft.com/en-us/help/830473/command-prompt-cmd-exe-command-line-string-limitation Command prompt (Cmd.exe) command-line string limitation]</ref> On [[Windows XP]] and later, the maximum length is 8191 (2<sup>13</sup>-1) characters. On earlier versions, such as [[Windows 2000]] or [[Windows NT 4.0]], the maximum length is 2047 (2<sup>11</sup>-1) characters. ===Escaping special characters=== The shell reserves the following characters as [[special character|special]]:<ref name="docs.microsoft.com"/> <code>&<>[]{}^=;!'+,`~</code> and [[whitespace character|whitespace]]. In some cases, an argument that contains such characters must be enclosed in double quotes to escape from the special character handling. For example: <syntaxhighlight lang="doscon">>echo me & you me 'you' is not recognized as an internal or external command, operable program or batch file. >echo "me & you" "me & you" </syntaxhighlight>
Edit summary
(Briefly describe your changes)
By publishing changes, you agree to the
Terms of Use
, and you irrevocably agree to release your contribution under the
CC BY-SA 4.0 License
and the
GFDL
. You agree that a hyperlink or URL is sufficient attribution under the Creative Commons license.
Cancel
Editing help
(opens in new window)