How to Scroll PowerShell Screen Buffer Without Mouse Using Keyboard Shortcuts (Like UNIX SHIFT+PageUp)


2 views

Windows PowerShell handles console buffering differently than traditional UNIX/Linux terminals. While bash users enjoy SHIFT+PageUp/PageDown navigation, PowerShell initially required mouse interaction or the more command for buffer scrolling.

Modern PowerShell versions (5.1+) support these keyboard shortcuts:

CTRL+UP/DOWN   - Scroll line by line
ALT+UP/DOWN    - Scroll page by page
F7             - Show command history
ESC            - Clear current line

For systems without native support, try these approaches:

# Pipe output through more
Get-Content largefile.txt | more

# Configure console properties
$console = $host.UI.RawUI
$buffer = $console.BufferSize
$buffer.Height = 3000
$console.BufferSize = $buffer

For advanced users, create custom key handlers:

# In profile.ps1
Set-PSReadLineKeyHandler -Chord 'Shift+PageUp' -ScriptBlock {
    [Console]::SetWindowPosition(0, [Console]::WindowTop - 1)
}

Set-PSReadLineKeyHandler -Chord 'Shift+PageDown' -ScriptBlock {
    [Console]::SetWindowPosition(0, [Console]::WindowTop + 1)
}

Consider these enhanced terminals that support UNIX-like scrolling:

  • Windows Terminal (recommended)
  • ConEmu
  • Cmder

html

When working with PowerShell on Windows, many developers coming from Unix/Linux environments miss the convenient keyboard shortcuts for scrolling through terminal output. While Unix terminals typically allow buffer navigation with SHIFT+PageUp/SHIFT+PageDown, PowerShell requires different approaches.

PowerShell has several built-in methods for buffer navigation:

# Basic keyboard shortcuts:
# Scroll up line-by-line: Ctrl+UpArrow
# Scroll down line-by-line: Ctrl+DownArrow
# Scroll page-by-page: Alt+PageUp/Alt+PageDown

First, increase your screen buffer size for better scrolling:

1. Right-click PowerShell title bar → Properties
2. Under Layout tab:
   - Screen Buffer Size Height: 9999
   - Window Size Height: 50 (or your preference)
3. Check "QuickEdit Mode" for better mouse selection

For more Unix-like behavior, try these PowerShell-native solutions:

# Pipe output to more.com (similar to Unix 'less')
Get-Content largefile.txt | more

# Use Out-Host with -Paging parameter
Get-Process | Out-Host -Paging

# For saved output, use Notepad
Get-Service > services.txt
notepad services.txt

For advanced users, create custom key bindings:

# In your PowerShell profile ($PROFILE)
Set-PSReadLineKeyHandler -Chord 'Shift+PageUp' -ScriptBlock {
    [Console]::WindowTop = [Math]::Max(0, [Console]::WindowTop - [Console]::WindowHeight)
}
Set-PSReadLineKeyHandler -Chord 'Shift+PageDown' -ScriptBlock {
    [Console]::WindowTop = [Math]::Min(
        [Console]::BufferHeight - [Console]::WindowHeight,
        [Console]::WindowTop + [Console]::WindowHeight
    )
}

Modern terminals offer better scrolling:

  • Windows Terminal (supports proper buffer scrolling)
  • ConEmu (customizable key bindings)
  • Hyper.js (electron-based terminal)
Method Shortcut Buffer Size Requires Setup
Native PS Alt+PageUp/Down Limited No
Custom Binding Shift+PageUp/Down Configurable Yes
Paging Cmdlets N/A Unlimited Minor
Third-party Term Varies Large Installation