It seems random: after some amount of time / usage of any console I use on Windows Vista, I lose the ability to use the command-line history (or command buffer, if you prefer...), and hitting the up or down arrow no longer does anything at all, meaning there are essentially 0 items available in the history.
I've seen this behavior in Cygwin, CMD, and PowerShell.
Sometimes this behavior applies to processes running inside the console - Python, MySQL client, etc.
Is this an inherent problem in Windows? A setting somewhere? Are there other consoles that don't have this problem?
ps - if you think this is non-programming related, please see other questions regarding programming tools, for instance, nearly anything tagged "eclipse" which deal with how to use the IDE rather than programming for it.
Unlike the Linux console, command history is only available for the current session. If you close Command Prompt, it will also clear the history, but you can the doskey command to save the history of the commands you typed to a file.
Open the Start menu and type cmd in the search bar. Right-click on the Command Prompt app and select Run as Administrator to proceed. Type the command doskey /h > c:\cmd_history. txt and press Enter.
To access previous commands, simply press the up arrow. This will give you the last command you typed in. Pressing it again will produce the command before that, and so on.
Command Prompt in Windows 11 to be replaced by Windows Terminal as the default experience. Windows Terminal was unveiled in 2019, and after a year in preview phase, it was released as an open source tool in 2020. Microsoft has announced that the Command Prompt in Windows 11 will be replaced by Windows Terminal.
Two ways, I think.
1) Far Manager is a good choice for a shell. Even if you don't need it's all power (file/archive management, editor, huge number of plugins, macros), you can use it as a wrapper/executor for cmd, tcc, sh or any other program, shell or command processor.
For example
History will be preserved between sessions, you may access it by Alt+F8 (press Ctrl+Alt+F to switch history into filter mode).
Far 2.0 stores history (and settings) in the registry.
Far 3.0 stores history in SQLite database, and may be portable.
Also, Far can autocomplete commands from history or files/paths from disk. And there is plugin (YAC) which can autocomplete from aliases and so on...
2) I have found recently interesting project: Clink - Bringing Bash's powerful command line editing to Microsoft Windows' cmd.exe
It seems a young but budding project, so I had created an option for use it in my Console Emulator.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With