如何在Windows CMD窗口中向上滚动?

PHP*_*Pst 6 windows scrolling cmd.exe

如您所知,方向键和翻页键用于在命令历史记录项之间移动。如何使用键盘向上滚动?

phu*_*clv 6

cmd.exe是一个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

旧版 Windows 中的默认终端是conhost.exe,它的滚动功能可以通过Alt+ SpaceE、/或/访问,正如 Remirol 回答的L那样(更新:现已删除),它也适用于 PowerShell,因为 PowerShell 默认情况下也使用 conhost。但 PowerShell 已经有了自己更方便的滚动快捷方式/ 。其他 shell 可能有类似的键,例如UpDownPageUpPageDownPageUpPageDownShift+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

  • Windows 终端Windows 11 中默认并且可以安装到较旧的 Windows)中,快捷键可以在 中自行定义settings.json。这是一个可以添加到"keybindings"该文件中的数组的示例

      // 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" },
    
    Run Code Online (Sandbox Code Playgroud)
  • ConEmu(及其“扩展” cmder )中,有各种事件可以滚动Key.Buf*Up缓冲区Key.Buf*Dn。默认情况下Ctrl+Up/DownCtrl+PgUp/PgDn将分别用于滚动一行和一页