Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to start the command interpreter Cmd.exe in Cmd

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article is about how to start the command interpreter Cmd.exe in Cmd. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.

Cmd

Start a new instance of the command interpreter Cmd.exe. If used without parameters, cmd displays the version and copyright information of the Windows XP.

Grammar

Cmd [[{/ c | / k}] [/ s] [/ Q] [/ d] [{/ a | / u}] [/ t:fg] [/ e: {on | off}] [/ f: {on | off}] [/ v: {on | off}] string]

Parameters.

/ c

Execute the command specified by string, and then stop.

/ k

Execute the command specified by string and continue.

/ s

Modify string processing after / c or / k.

/ q

Turn off echo.

/ d

Disable autorun command execution.

/ a

Create the American National Standards Institute (ANSI) output.

/ u

Create Unicode output.

/ t:fg

Set the color of foreground f and background g. The following table lists valid hexadecimal digits that can be used as values for f and g. Value color

0 black

1 blue

2 green

3 Lake blue

4 red

5 purple

6 yellow

7 White

8 Gray

9 light blue

A light green

B shallow water green

C light red

D light purple

E light yellow

F bright white

/ e:on

Enable command extension.

/ e:off

Disable command extension.

/ f:on

Enable file and directory name completion.

/ f:off

Disable file and directory name completion.

/ v:on

Enables delayed environment variable extension.

/ v:off

Disable delayed environment variable extension.

String

Specify the command to execute.

/?

Displays help at the command prompt.

Annotation

Use multiple commands

Multiple commands separated by & & can be used in string, but they must be enclosed in quotation marks (for example, "command&&command&&command").

Deal with quotation marks

If / c or / k is specified, cmd processes the remaining commands in string and retains quotation marks if all of the following conditions are met:

/ s is not used.

Use a pair of quotation marks correctly.

No special characters are used within quotation marks (for example: & () @ ^ |}.

One or more space subcharacters are used within quotation marks.

The string in quotation marks is the name of the executable file.

If the above conditions are not met, the first character of the string is first checked to verify that it is in left quotation marks. If the first character is a left quotation mark, it is separated from the right quote. Any text that follows the closing quotation mark is preserved.

Execute registry subkey

If / drecoery Cmd.exe is not specified in string, it looks for the following registry subkeys:

HKEY_LOCAL_MACHINE\ Software\ Microsoft\ Command Processor\ AutoRun\ REG_SZ

HKEY_CURRENT_USER\ Software\ Microsoft\ Command Processor\ AutoRun REG_EXPAND_SZ

If one or both of the above registry subkeys exist, they are executed before the other variables are executed.

Warning

Improper editing of the registry can seriously damage your system. Any valuable data on your computer should be backed up before changing the registry.

Enable and disable command extension

In Windows XP, command extension is enabled by default. You can disable them with / e:off for specific procedures. You can enable or disable the extension of all cmd command line options on your computer or in a user session by setting the following REG_DWORD values:

HKEY_LOCAL_MACHINE\ Software\ Microsoft\ Command Processor\ EnableExtensions\ REG_DWORD

HKEY_CURRENT_USER\ Software\ Microsoft\ Command Processor\ EnableExtensions\ REG_DWORD

Use Regedit.exe in the registry to set the REG_DWORD value to 0 × 1 (that is, enabled) or 0 × 0 (that is, disabled). User-specific settings take precedence over computer settings, and command line options take precedence over registry settings.

Warning

Improper editing of the registry can seriously damage your system. Any valuable data on your computer should be backed up before changing the registry.

When the command extension is enabled, the following commands are affected:

Assoc

Call

Chdir (cd)

Color

Del (erase)

Endlocal

For

Ftype

Goto

If

Mkdir (md)

Popd

Prompt

Pushd

Set

Setlocal

Shift

Start (also includes changes to external command procedures)

For more information about these commands, see.

Enable delayed environment variable extension

Enable delayed environment variable extension, and you can use exclamation point characters to replace the runtime environment variable value.

Enable file and directory name completion

By default, file and directory name completion is disabled. For specific cmd command processing, you can enable or disable this feature through / f: {on | off}. You can enable or disable file and directory name completion processed by all cmd commands on your computer or in a user session by setting the following REG_DWORD values:

HKEY_LOCAL_MACHINE\ Software\ Microsoft\ Command Processor\ CompletionChar\ REG_DWORD

HKEY_LOCAL_MACHINE\ Software\ Microsoft\ Command Processor\ PathCompletionChar\ REG_DWORD

HKEY_CURRENT_USER\ Software\ Microsoft\ Command Processor\ CompletionChar\ REG_DWORD

HKEY_CURRENT_USER\ Software\ Microsoft\ Command Processor\ PathCompletionChar\ REG_DWORD

To set the REG_DWORD value, run Regedit.exe and use the hexadecimal value of the control character for a specific function (for example, 0 × 9 for TAB key and 0 × 08 for BACKSPACE key). User-specific settings take precedence over computer settings, and command line options take precedence over registry settings.

Warning

Improper editing of the registry can seriously damage your system. Any valuable data on your computer should be backed up before changing the registry.

If file and directory name completion is enabled with / f:on, CTRL+D key combination can be used for directory name completion, and CTRL+F key combination can be used for file name completion. To disable the completion of specific characters in the registry, use the space value [0 × 20] because spaces are not valid control characters.

When you press CTRL+D or CTRL+F, cmd handles the completion of file and directory names. The purpose of these key combinations is to append wildcards (if not already used) after the string, create a list of matching paths, and then display the first matching path. If all paths do not match, the file and directory name completion operation issues a warning sound and does not change what is displayed. To view the paths in the list of matching paths one by one, press CTRL+D or CTRL+F repeatedly. To view the list backwards, press CTRL+D or CTRL+F while pressing SHIFT. To discard the saved list of matching paths and generate a new list, edit string and press CTRL+D or CTRL+F. If you switch between CTRL+D and CTRL+F, the saved list of matching paths is discarded and a new list is generated. The only difference between the CTRL+D and CTRL+F key combinations is that CTRL+D matches only the directory name, while CTRL+F matches both the file name and the directory name. If file and directory name completion is used in any internal directory command (CD, MD, or RD), only directory completion is used.

If you enclose the matching path in quotation marks, file and directory name completion correctly handles file names that contain spaces or special characters.

The following special characters require quotation marks: &

< >

[] {} ^ =;!'+, `~ [white space]

If the information you provide contains spaces, enclose the text in quotation marks (for example, "Computer Name").

If the file and directory names are processed from string to complete the operation, any part of [Path] to the right of the cursor is discarded (that is, the location in string where the operation is completed).

Thank you for reading! This is the end of the article on "how to start the command interpreter Cmd.exe in Cmd". I hope the above content can be of some help to you, so that you can learn more knowledge. if you think the article is good, you can share it for more people to see!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report