Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unable to change the CMD command history buffer size #13385

Closed
alexolog opened this issue Jun 27, 2022 · 15 comments
Closed

Unable to change the CMD command history buffer size #13385

alexolog opened this issue Jun 27, 2022 · 15 comments
Labels
Area-Extensibility A feature that would ideally be fulfilled by us having an extension model. Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.

Comments

@alexolog
Copy link

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.

@alexolog alexolog added the Issue-Bug It either shouldn't be doing this or needs an investigation. label Jun 27, 2022
@ghost ghost added Needs-Tag-Fix Doesn't match tag requirements Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting labels Jun 27, 2022
@237dmitry
Copy link

Version: 1.14.1452.0
Screenshot 2022-06-27 071038

@alexolog
Copy link
Author

alexolog commented 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.

@237dmitry
Copy link

The CMD counterpart is

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

@alexolog
Copy link
Author

alexolog commented 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
Copy link
Author

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.

@237dmitry
Copy link

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.

@lhecker lhecker added Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Area-Extensibility A feature that would ideally be fulfilled by us having an extension model. and removed Issue-Bug It either shouldn't be doing this or needs an investigation. labels Jun 27, 2022
@lhecker
Copy link
Member

lhecker commented 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

@ghost ghost added the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jun 27, 2022
@lhecker lhecker removed the Needs-Author-Feedback The original author of the issue/PR needs to come back and respond to something label Jun 27, 2022
@DHowett
Copy link
Member

DHowett commented 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 :)

@ghost
Copy link

ghost commented 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 ghost closed this as completed Jun 27, 2022
@ghost ghost added Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing. and removed Needs-Triage It's a new issue that the core contributor team needs to triage at the next triage meeting Needs-Tag-Fix Doesn't match tag requirements labels Jun 27, 2022
@alexolog
Copy link
Author

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

It's almost 3 years of tracking.

@DHowett
Copy link
Member

DHowett commented 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.

@alexolog
Copy link
Author

That's quite the understatement.

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

@o-sdn-o
Copy link

o-sdn-o commented Oct 20, 2023

@alexolog It is related to #16198.

@alexolog
Copy link
Author

That one is closed.

@o-sdn-o
Copy link

o-sdn-o commented Oct 21, 2023

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

This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area-Extensibility A feature that would ideally be fulfilled by us having an extension model. Issue-Feature Complex enough to require an in depth planning process and actual budgeted, scheduled work. Resolution-Duplicate There's another issue on the tracker that's pretty much the same thing.
Projects
None yet
Development

No branches or pull requests

5 participants