命令提示符默认值的默认设置保存在哪里?


20

在哪里保存命令提示符默认值的默认设置?它们存储在注册表中的某个位置还是文件中?

.reg第一次登录计算机时,我希望创建一个文件来设置我的默认首选项。

我说的是默认应用程序设置:快速编辑模式,缓冲区大小,文本颜色等。

Answers:


21

HKEY_CURRENT_USER\Console下面,所有控制台和子项都有一些默认设置,而控制台程序则有单独的设置。你可能想看看这些设置,尤其是在QuickEditScreenBufferSizeScreenColors,等。


1
正是我想要的。
Keltari 2013年

2
由于另一个问题提到了,如果你使用的是Windows 10,设置不再保存在注册表中,但只有在.LNK文件。(有关详细信息,请参见答案。)
RobH

@RobH 默认值仍在注册表中,但属性在Windows 10中的lnk文件中。–
WesternGun

6

更新了答案以回应已编辑的问题

建议您在桌面上为CMD.EXE创建一个快捷方式,然后编辑属性以获取所需的设置。然后将快捷方式复制到便携式设备(例如USB拇指驱动器)或网络文件夹。您应该能够从任何计算机启动快捷方式并获得所需的设置。

原始答案处理完全不同的设置

我知道可能由注册表控制的四个设置:

  • 自动运行
  • 扩展名
  • 延迟扩张
  • 文件名补全

注册表设置记录在内置帮助中,可通过键入以下内容从命令行访问 HELP CMDCMD /?

以下是相关帮助的摘录:

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 REGEDIT.EXE:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\EnableExtensio

        and/or

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\EnableExtension

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.

In a batch file, the SETLOCAL ENABLEEXTENSIONS or DISABLEEXTENSIONS argume
takes precedence over the /E:ON or /E:OFF switch. See SETLOCAL /? for deta

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 delayed expansion for all invocations of CMD.EXE on
machine and/or user logon session by setting either or both of the
following REG_DWORD values in the registry using REGEDIT.EXE:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\DelayedExpansi

        and/or

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\DelayedExpansio

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.

In a batch file the SETLOCAL ENABLEDELAYEDEXPANSION or DISABLEDELAYEDEXPAN
arguments takes precedence over the /V:ON or /V:OFF switch. See SETLOCAL /
for details.

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.

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 REGEDIT.EXE:

    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\CompletionChar
    HKEY_LOCAL_MACHINE\Software\Microsoft\Command Processor\PathCompletion

        and/or

    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\CompletionChar
    HKEY_CURRENT_USER\Software\Microsoft\Command Processor\PathCompletionC

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>
     &()[]{}^=;!'+,`~

3

这是我为Windows 10做的:

  1. 完全按照以下步骤将其粘贴到Windows资源管理器中:

    %LOCALAPPDATA%\Microsoft\Windows\WinX\Group3\
    
  2. 右键单击两个 “命令提示符”快捷方式,然后选择“属性”

  3. 编辑这些选项卡将更改命令提示符的默认设置:

    • 字形
    • 布局
    • 色彩
    • 选项

请记住,两个快捷方式的设置都需要更改。我不确定为什么有两个。:/


此答案似乎不适用于早期版本的Windows,该问题在2013年提出,因此仅适用于Windows 10的答案对作者没有帮助。我怎样才能知道这仅适用于Windows 10?由于WinX路径中的,这些设置的位置显然适用于Windows 10上存在的Improvement命令提示符。
Ramhound

2
仅仅因为在2013年提出了这个问题,并不意味着问问者从那以后就没有将其操作系统升级到Windows 10。另外,这是一个非常简单的问题答案,它将帮助拥有Windows 10的其他人找到默认的命令提示符设置。我认为我的答案不值得您给它-1。
Daniel Tonon

1
投票之所以是一致的,出于某种原因,我认为我不应该因发布投票而受到人身攻击
Ramhound

世界需要的最后一件事是另一个人试图避免对自己的行为承担责任。
kreemoweet
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.