Skip to content

Unable to change the CMD command history buffer size #13385

Closed

Description

@alexolog

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.

Activity

  1. added
    Issue-Bug
    on Jun 27, 2022
  2. ghost added
    Needs-Tag-Fix
    on Jun 27, 2022
  3. ghost added
    Needs-Triage
    on Jun 27, 2022
  4. 237dmitry commented on Jun 27, 2022

    @237dmitry

    Version: 1.14.1452.0
    Screenshot 2022-06-27 071038

  5. alexolog commented on Jun 27, 2022

    @alexolog
    Author

    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.

  6. 237dmitry commented on Jun 27, 2022

    @237dmitry

    The CMD counterpart is

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

  7. alexolog commented on Jun 27, 2022

    @alexolog
    Author

    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).

  8. alexolog commented on Jun 27, 2022

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

  9. 237dmitry commented on Jun 27, 2022

    @237dmitry

    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.

  10. added
    Issue-Feature
    Area-Extensibility
    and removed
    Issue-Bug
    on Jun 27, 2022
  11. lhecker commented on Jun 27, 2022

    @lhecker
    Member

    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
    
  12. ghost added
    Needs-Author-Feedback
    on Jun 27, 2022
  13. removed
    Needs-Author-Feedback
    on Jun 27, 2022
  14. DHowett commented on Jun 27, 2022

    @DHowett
    Member

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

  15. ghost closed this as completedon Jun 27, 2022
  16. ghost removed
    Needs-Triage
    on Jun 27, 2022
  17. ghost added
    Resolution-Duplicate
    on Jun 27, 2022
  18. ghost removed
    Needs-Tag-Fix
    on Jun 27, 2022
  19. alexolog commented on Jun 27, 2022

    @alexolog
    Author

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

    It's almost 3 years of tracking.

  20. DHowett commented on Jun 27, 2022

    @DHowett
    Member

    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.

  21. alexolog commented on Jun 29, 2022

    @alexolog
    Author

    That's quite the understatement.

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

  22. o-sdn-o commented on Oct 20, 2023

    @o-sdn-o

    Alex (@alexolog) It is related to #16198.

  23. alexolog commented on Oct 21, 2023

    @alexolog
    Author

    That one is closed.

  24. o-sdn-o commented on Oct 21, 2023

    @o-sdn-o

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Area-ExtensibilityIssue-FeatureResolution-Duplicate

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions