Unable to change the CMD command history buffer size #17809

Closed
opened 2026-01-31 05:54:07 +00:00 by claunia · 15 comments
Owner

Originally created by @alexolog on GitHub (Jun 27, 2022).

Windows Terminal version

1.13.11431.0

Windows build number

10.0.19043.1645

Other Software

No response

Steps to reproduce

When running CMD inside WT, there seems to be no way to change the history buffer size like I can do when running CMD natively, it is stuck at 50, which is not enough.

This CMD option is not exposed via the settings:

image

Expected Behavior

Able to change the command history buffer size.

Actual Behavior

Unable to change the command history buffer size.

Originally created by @alexolog on GitHub (Jun 27, 2022). ### Windows Terminal version 1.13.11431.0 ### Windows build number 10.0.19043.1645 ### Other Software _No response_ ### Steps to reproduce When running CMD inside WT, there seems to be no way to change the history buffer size like I can do when running CMD natively, it is stuck at 50, which is not enough. This CMD option is not exposed via the settings: ![image](https://user-images.githubusercontent.com/2112513/175841170-fa71ee34-6e16-4fac-8e92-f42fc5a700c3.png) ### Expected Behavior Able to change the command history buffer size. ### Actual Behavior Unable to change the command history buffer size.
claunia added the Issue-FeatureResolution-DuplicateArea-Extensibility labels 2026-01-31 05:54:07 +00:00
Author
Owner

@237dmitry commented on GitHub (Jun 27, 2022):

Version: 1.14.1452.0
Screenshot 2022-06-27 071038

@237dmitry commented on GitHub (Jun 27, 2022): Version: 1.14.1452.0 ![Screenshot 2022-06-27 071038](https://user-images.githubusercontent.com/78153320/175858628-6f74658e-eca7-4c1b-9ea6-41800582a762.png)
Author
Owner

@alexolog commented on GitHub (Jun 27, 2022):

Version: 1.14.1452.0 Screenshot 2022-06-27 071038

This is the screen scrollback buffer, not the command history.

The CMD counterpart is:

image

Yes, the description is confusing.

@alexolog commented on GitHub (Jun 27, 2022): > Version: 1.14.1452.0 ![Screenshot 2022-06-27 071038](https://user-images.githubusercontent.com/78153320/175858628-6f74658e-eca7-4c1b-9ea6-41800582a762.png) This is the screen scrollback buffer, not the command history. The CMD counterpart is: ![image](https://user-images.githubusercontent.com/2112513/175865236-4a766b0d-db55-4295-be7c-87c6dd9dfed7.png) Yes, the description is confusing.
Author
Owner

@237dmitry commented on GitHub (Jun 27, 2022):

The CMD counterpart is

I think this is a problem of cmd.exe, Windows Terminal is just host for shells and console applications.

@237dmitry commented on GitHub (Jun 27, 2022): > The CMD counterpart is I think this is a problem of cmd.exe, Windows Terminal is just host for shells and console applications.
Author
Owner

@alexolog commented on GitHub (Jun 27, 2022):

I think this is a problem of cmd.exe, Windows Terminal is just host for shells and console applications.

How exactly is this a problem with CMD? CMD exposes both options (command history and screen history), WT only exposes one (screen history).

@alexolog commented on GitHub (Jun 27, 2022): > I think this is a problem of cmd.exe, Windows Terminal is just host for shells and console applications. How exactly is this a problem with CMD? CMD exposes both options (command history and screen history), WT only exposes one (screen history).
Author
Owner

@alexolog commented on GitHub (Jun 27, 2022):

I can have a history of more than 50 last entered commands in CMD.

For example, hitting F7:
image

When CMD runs under WT, only 50 entries are available and I cannot find a way to increase the limit because WT does not expose this setting.

@alexolog commented on GitHub (Jun 27, 2022): I can have a history of more than 50 last entered commands in CMD. For example, hitting F7: ![image](https://user-images.githubusercontent.com/2112513/175963179-7ad12925-b689-472d-9864-cd67bdd769c7.png) When CMD runs under WT, only 50 entries are available and I cannot find a way to increase the limit because WT does not expose this setting.
Author
Owner

@237dmitry commented on GitHub (Jun 27, 2022):

I can have a history of more than 50 last entered commands in CMD.

Now I understand, I completely forgot about this function. Yes it shows only 50 history items in WT then doskey /history shows full list.

@237dmitry commented on GitHub (Jun 27, 2022): > I can have a history of more than 50 last entered commands in CMD. Now I understand, I completely forgot about this function. Yes it shows only 50 history items in WT then `doskey /history` shows full list.
Author
Owner

@lhecker commented on GitHub (Jun 27, 2022):

This would be a great idea for a potential user extension for Windows Terminal. But as far as I know there currently aren't any plans to offer shell-specific settings within the settings UI of Windows Terminal ourselves - it wouldn't align with the fundamental idea that Windows Terminal is just a "terminal" and shells need to provide their configurability in some other way.

In case of cmd.exe you can achieve your goal in two ways. As cmd /? notes:

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

Into the AutoRun value you can then write for instance doskey /listsize=100.

Alternatively, and maybe the safer option, you could modify your cmd profile to have a command line like this:

%SystemRoot%\System32\cmd.exe /K doskey /listsize=100
@lhecker commented on GitHub (Jun 27, 2022): This would be a great idea for a potential user extension for Windows Terminal. But as far as I know there currently aren't any plans to offer shell-specific settings _within_ the settings UI of Windows Terminal ourselves - it wouldn't align with the fundamental idea that Windows Terminal is just a "terminal" and shells need to provide their configurability in some other way. In case of cmd.exe you can achieve your goal in two ways. As `cmd /?` notes: ``` 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 ``` Into the `AutoRun` value you can then write for instance `doskey /listsize=100`. Alternatively, and maybe the safer option, you could modify your cmd profile to have a command line like this: ``` %SystemRoot%\System32\cmd.exe /K doskey /listsize=100 ```
Author
Owner

@DHowett commented on GitHub (Jun 27, 2022):

Unfortunately, this is not a shell setting. This is the murky gray area between the console and the shell.

In our case, it is the console host that stores command history and maintains the buffers. We are tracking making this configurable or infinite at /dup #2558 :)

@DHowett commented on GitHub (Jun 27, 2022): Unfortunately, this is _not_ a shell setting. This is the murky gray area between the console and the shell. In our case, it is the console host that stores command history and maintains the buffers. We are tracking making this configurable or infinite at /dup #2558 :)
Author
Owner

@ghost commented on GitHub (Jun 27, 2022):

Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!

@ghost commented on GitHub (Jun 27, 2022): Hi! We've identified this issue as a duplicate of another one that already exists on this Issue Tracker. This specific instance is being closed in favor of tracking the concern over on the referenced thread. Thanks for your report!
Author
Owner

@alexolog commented on GitHub (Jun 27, 2022):

We are tracking making this configurable or infinite at /dup #2558 :)

It's almost 3 years of tracking.

@alexolog commented on GitHub (Jun 27, 2022): > We are tracking making this configurable or infinite at /dup #2558 :) It's almost 3 years of tracking.
Author
Owner

@DHowett commented on GitHub (Jun 27, 2022):

That's true. Most folks who use Terminal moved on to newer shells that are receiving maintenance--which also generally maintain their own history data--rather than cmd, so it has not been prioritized very highly.

@DHowett commented on GitHub (Jun 27, 2022): That's true. Most folks who use Terminal moved on to newer shells that are receiving maintenance--which also generally maintain their own history data--rather than cmd, so it has not been prioritized very highly.
Author
Owner

@alexolog commented on GitHub (Jun 29, 2022):

That's quite the understatement.

Unfortunately, doskey /listsize does not seem to work on my machine, even in a plain CMD window.

@alexolog commented on GitHub (Jun 29, 2022): That's quite the understatement. Unfortunately, `doskey /listsize` does not seem to work on my machine, even in a plain CMD window.
Author
Owner

@o-sdn-o commented on GitHub (Oct 20, 2023):

@alexolog It is related to #16198.

@o-sdn-o commented on GitHub (Oct 20, 2023): @alexolog It is related to #16198.
Author
Owner

@alexolog commented on GitHub (Oct 21, 2023):

That one is closed.

@alexolog commented on GitHub (Oct 21, 2023): That one is closed.
Author
Owner

@o-sdn-o commented on GitHub (Oct 21, 2023):

There is a bug in the kernel and the fix for doskey /listsize is only available in Win11+.

@o-sdn-o commented on GitHub (Oct 21, 2023): There is a bug in the kernel and the fix for `doskey /listsize` is only available in Win11+.
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/terminal#17809