7

As you know directional key and page keys are used to move between command history items. How can I scroll up using the keyboard?

Real Dreams
  • 4,988

1 Answers1

7

cmd.exe is a shell and not a terminal. Many terminals actually have their own way to scroll the console window without passing the shortcut key to the shell so you can easily scroll any shells running in it including cmd

The default terminal in older Windows is conhost.exe and it's scrolling feature can be accessed via Alt+Space, E, L then Up/Down or PageUp/PageDown as Remirol answered (update: now deleted), and it works in PowerShell too because PowerShell also uses conhost by default. But PowerShell already has its own more convenient scrolling shortcut which is PageUp/PageDown. Other shells may have similar keys, like Shift+PageUp/PageDown in bash. Unfortunately cmd only has a key to scroll by line and not by page

If you use another better terminal then they likely have their own scrolling shortcut. For example

  • In Windows terminal (default in Windows 11 and can be installed to older Windows) shortcut keys can be defined by yourself in settings.json. Here's an example that you can add to the "keybindings" array in that file

      // Unbind keys first from any other actions so that we can use
      { "command": "unbound", "keys": "ctrl+shift+pageup" },
      { "command": "unbound", "keys": "ctrl+shift+pagedown" },
      { "command": "unbound", "keys": "ctrl+shift+up" },
      { "command": "unbound", "keys": "ctrl+shift+down" },
    

    { "command": "scrollUpPage", "keys": "ctrl+shift+pageup" }, { "command": "scrollDownPage", "keys": "ctrl+shift+pagedown" }, { "command": "scrollUp", "keys": "ctrl+shift+up" }, { "command": "scrollDown", "keys": "ctrl+shift+down" },

  • In ConEmu (and its "extension" cmder) there are various Key.Buf*Up and Key.Buf*Dn events to scroll the buffer. By default Ctrl+Up/Down and Ctrl+PgUp/PgDn will be used to scroll a line and a page respectively

phuclv
  • 27,773
  • 1
    I found myself here searching for the equivalent Windows Terminal keybindings and through trial and error it turns out ctrl + shift + Page Up / Up Arrow Key works by default without entries in the settings.json. – cyclingLinguist Oct 30 '23 at 14:53