CMD: Starts a new instance of the Windows command interpreter.


 


... The examples for the command "CMD"
... "CMD" Excerpt from Microsoft Windows Help
... Important information, tips for the "CMD" command

The command: "CMD" is on Windows 12, 11, 10, .. , MS Server 2025, 2022, 2019, .. available

The examples for the command "CMD"

"CMD" is often used as a general name for the Windows Command Prompt or the Windows command line interface. If you mean examples of using the Windows Command Prompt (`CMD.exe`), here are some examples: Example 1: Simple command execution:

echo Hello, world!

Description: This command returns the string "Hello, world!" in the console. Example 2: Show directory change and file list:

cd C:\Windows
you

Description: This command switches to the C:\Windows directory and then displays a list of files in that directory. Example 3: Copying files:

copy C:\Source\File.txt D:\Destination\

Description: This command copies the file "File.txt" from "C:\Source\" to "D:\Destination\". Example 4: Network diagnostics with ping:

ping www.google.com

Description: This command sends ping requests to the IP address of www.google.com to test the network connection. Example 5: Starting Notepad:

start notepad

Description: This command starts the Notepad program. Example 6: View system information:

system info

Description: This command displays extensive information about the system, including operating system version, installation date, and more. Example 7: Show environment variables:

echo %USERNAME%

Description: This command prints the current user's username stored in the `%USERNAME%` environment variable. Example 8: Create batch script:

echo echo Hello, %USERNAME%! > Welcome.bat

Description: This command creates a simple batch script named "Greeting.bat" that greets the username. Example 9: Show help for a command:

help you

Description: This command displays help for the `dir` command and returns a list of available options and parameters. These examples are intended to provide an overview of different types of commands in the Windows Command Prompt. You can customize and extend these commands and syntax as needed.

"CMD" Excerpt from Microsoft Windows Help

Microsoft Windows [Version 10.0.19045.3693]
(c) Copyright 1985-2023 Microsoft Corp.

C:\\WINDOWS>

Starts a new instance of the Windows XP command interpreter

CMD [/A | /U] [/Q] [/D] [/E:ON | /E:OFF] [/F:ON | /F:OFF] [/V:ON | /V:OFF]
    [[/S] [/C | /K] string]

/C      Carries out the command specified by string and then terminates
/K      Carries out the command specified by string but remains
/S      Modifies the treatment of string after /C or /K (see below)
/Q      Turns echo off
/D      Disable execution of AutoRun commands from registry (see below)
/A      Causes the output of internal commands to a pipe or file to be ANSI
/U      Causes the output of internal commands to a pipe or file to be
        Unicode
/T:fg   Sets the foreground/background colors (see COLOR /? for more info)
/E:ON   Enable command extensions (see below)
/E:OFF  Disable command extensions (see below)
/F:ON   Enable file and directory name completion characters (see below)
/F:OFF  Disable file and directory name completion characters (see below)
/V:ON   Enable delayed environment variable expansion using ! as the
        delimiter. For example, /V:ON would allow !var! to expand the
        variable var at execution time.  The var syntax expands variables
        at input time, which is quite a different thing when inside of a FOR
        loop.
/V:OFF  Disable delayed environment expansion.

Note that multiple commands separated by the command separator '&&'
are accepted for string if surrounded by quotes.  Also, for compatibility
reasons, /X is the same as /E:ON, /Y is the same as /E:OFF and /R is the
same as /C.  Any other switches are ignored.

If /C or /K is specified, then the remainder of the command line after
the switch is processed as a command line, where the following logic is
used to process quote (") characters:

    1.  If all of the following conditions are met, then quote characters
        on the command line are preserved:

        - no /S switch
        - exactly two quote characters
        - no special characters between the two quote characters,
          where special is one of: &<>()@^|
        - there are one or more whitespace characters between the
          the two quote characters
        - the string between the two quote characters is the name
          of an executable file.

    2.  Otherwise, old behavior is to see if the first character is
        a quote character and if so, strip the leading character and
        remove the last quote character on the command line, preserving
        any text after the last quote character.

If /D was NOT specified on the command line, then when CMD.EXE starts, it
looks for the following REG_SZ/REG_EXPAND_SZ registry variables, and if
either or both are present, they are executed first.

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\AutoRun

        and/or

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\AutoRun

Command Extensions are enabled by default.  You may also disable
extensions for a particular invocation by using the /E:OFF switch.  You
can enable or disable extensions for all invocations of CMD.EXE on a
machine and/or user logon session by setting either or both of the
following REG_DWORD values in the registry using REGEDT32.EXE:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensions

        and/or

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtensions

to either 0x1 or 0x0.  The user specific setting takes precedence over
the machine setting.  The command line switches take precedence over the
registry settings.

The command extensions involve changes and/or additions to the following
commands:

    DEL or ERASE
    COLOR
    CD or CHDIR
    MD or MKDIR
    PROMPT
    PUSHD
    POPD
    SET
    SETLOCAL
    ENDLOCAL
    IF
    FOR
    CALL
    SHIFT
    GOTO
    START (also includes changes to external command invocation)
    ASSOC
    FTYPE

To get specific details, type commandname /? to view the specifics.

Delayed environment variable expansion is NOT enabled by default.  You
can enable or disable delayed environment variable expansion for a
particular invocation of CMD.EXE with the /V:ON or /V:OFF switch.  You
can enable or disable completion for all invocations of CMD.EXE on a
machine and/or user logon session by setting either or both of the
following REG_DWORD values in the registry using REGEDT32.EXE:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\DelayedExpansion

        and/or

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\DelayedExpansion

to either 0x1 or 0x0.  The user specific setting takes precedence over
the machine setting.  The command line switches take precedence over the
registry settings.

If delayed environment variable expansion is enabled, then the exclamation
character can be used to substitute the value of an environment variable
at execution time.

File and Directory name completion is NOT enabled by default.  You can
enable or disable file name completion for a particular invocation of
CMD.EXE with the /F:ON or /F:OFF switch.  You can enable or disable
completion for all invocations of CMD.EXE on a machine and/or user logon
session by setting either or both of the following REG_DWORD values in
the registry using REGEDT32.EXE:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar
    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletionChar

        and/or

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar
    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionChar

with the hex value of a control character to use for a particular
function (e.g.  0x4 is Ctrl-D and 0x6 is Ctrl-F).  The user specific
settings take precedence over the machine settings.  The command line
switches take precedence over the registry settings.

If completion is enabled with the /F:ON switch, the two control
characters used are Ctrl-D for directory name completion and Ctrl-F for
file name completion.  To disable a particular completion character in
the registry, use the value for space (0x20) as it is not a valid
control character.

Completion is invoked when you type either of the two control
characters.  The completion function takes the path string to the left
of the cursor appends a wild card character to it if none is already
present and builds up a list of paths that match.  It then displays the
first matching path.  If no paths match, it just beeps and leaves the
display alone.  Thereafter, repeated pressing of the same control
character will cycle through the list of matching paths.  Pressing the
Shift key with the control character will move through the list
backwards.  If you edit the line in any way and press the control
character again, the saved list of matching paths is discarded and a new
one generated.  The same occurs if you switch between file and directory
name completion.  The only difference between the two control characters
is the file completion character matches both file and directory names,
while the directory completion character only matches directory names.
If file completion is used on any of the built in directory commands
(CD, MD or RD) then directory completion is assumed.

The completion code deals correctly with file names that contain spaces
or other special characters by placing quotes around the matching path.
Also, if you back up, then invoke completion from within a line, the
text to the right of the cursor at the point completion was invoked is
discarded.

The special characters that require quotes are:
     <space>
     &()[]

Important information, tips for the "CMD" command

When working with the Windows Command Prompt (CMD), there are a few important points to keep in mind in order to act efficiently and safely: 1. Admin Privileges: Some commands require administrator privileges. Be sure to open Command Prompt as an administrator if you want to access system areas or make system changes. 2. Filenames and Paths: If file or directory names contain spaces or special characters, enclose them in quotation marks. Example: `cd "C:\Program Files"` 3. Show file extensions: By default, Command Prompt does not display file extensions. You can change this by typing `echo %PATHEXT%`. If necessary, you can add it with `set PATHEXT=.;%PATHEXT%`. 4. TAB key for autocomplete: You can use the TAB key to autocomplete filenames and directories. This can significantly reduce input time. 5. Command History: Use the up and down arrow keys to navigate through the command history. This allows commands to be re-executed without re-entry. 6. Command Reference: If you need information about a specific command, append `/?` to the command, e.g. E.g. `dir /?`. This displays help for the command. 7. Copy and Paste: You can right-click to copy text and then right-click and paste it into Command Prompt. 8. Switch Drive Letter: You can switch between drives by entering the drive letter followed by a colon (e.g., `D:`). 9. Error Checking: Check error messages carefully. They can indicate issues with command input, permissions, or other things. 10. Batch Files: When creating batch files, make sure paths are relative and not absolute to ensure portability. 11. Handle `DEL` or `RD` with care: Deleting files (`DEL`) or directories (`RD` or `RMDIR`) can have irreversible effects. Use with caution and double check before hitting enter. 12. Adjust CMD Window Size: You can adjust the size of the CMD window to display more or less information at a time. 13. Security Considerations: Be careful when executing commands or scripts from unknown sources. Malicious code can cause damage to the system. 14. Data Backup: When working with commands that access or manipulate data, make sure you have a backup of important data to avoid data loss. By keeping these points in mind, you can use the Windows Command Prompt effectively and safely. It is always advisable to be careful, especially when commands can affect system resources.


Deutsch
English
Español
Français
Italiano
日本語 (Nihongo)
한국어 (Hangugeo)
汉语 (Hànyǔ)
Türkçe
Português
Português
Svenska
Norsk
Dansk
Suomi
Nederlands
Polski









Windows-10


... Windows 10 FAQ
... Windows 10 How To


Windows 10 How To


... Windows 11 How To
... Windows 10 FAQ



The command CMD - Starts a new instance of the Windows command interpreter.

HTTP: ... console/en/013.htm
0.077
16011
What is a keyboard layout? What does mounted mean? What are Unicode fonts? WINDOWS SETTING MS SETTINGS NETWORK DIRECTACCESS WINDOWS SETTING MS SETTINGS MULTITASKING Hard disks, Hard drive? What is bloatware? WINDOWS SETTING MS SETTINGS EASEOFACCESS MOUSE Should I use with AMD64 Windows-7 x86 or x64? How can I create a Windows 7 universal DVD or ISO with all editions?



(0)