SEARCH

How-To Geek

How to Scroll the Command Prompt Window with the Keyboard

If you’re using a real Linux shell, you can usually scroll up from the keyboard, but sadly that’s not an option in the Windows command shell world. Naturally, we can fix this up with a little AutoHotkey magic.

Of course, there actually is a way to scroll the command prompt with the keyboard, but it’s really complicated and requires too many keystrokes to be useful. This is a better way.

image

What we’ll do to solve the problem is create an AutoHotkey script that makes it so whenever you press Shift+Page Up/Down,  or Ctrl + Up/Down, it will send a mouse wheel scroll command to the window, scrolling it up or down.

Setting Up the Scrolling Window Script

Create a new AutoHotkey script, or paste the following into your existing script:

#IfWinActive ahk_class ConsoleWindowClass
+PgUp::
Send {WheelUp}
Return

+PgDn::
Send {WheelDown}
Return

^Up::
Send {WheelUp}
Return

^Down::
Send {WheelDown}
Return

#IfWinActive

Once you’ve done so, save the script and double-click on it to start it up—you’ll be able to scroll the command prompt window with the keyboard now. Personally I prefer using Shift+Page Up or Down to scroll, since that’s the more Linux way to do it.

If you want to add this to your startup to run every time you start your PC, open up a new Windows Explorer window and type in the following into the location bar:

shell:startup

image

Then simply put a shortcut to the AutoHotkey script into that folder.

Extra: if you like this one, make sure to read our article on how to enable Ctrl+V for pasting into the Windows command prompt.

Downloadable Scrolling Window Script

Simply download, extract, and double-click on the script file. Note: if you want to remove the tray icon from the script when it’s running, you’ll need to add the #NoTrayIcon line to the beginning of the script.

Download ScrollingCommandPrompt AutoHotkey Script

Lowell Heddings, better known online as the How-To Geek, spends all his free time bringing you fresh geekery on a daily basis. You can follow him on if you'd like.

  • Published 08/31/10

Comments (2)

  1. Jason Faulkner

    Love it!

  2. mark

    the scroll-by-page setting in win7 is fscked when applied to command prompt – thinks the page size is 120 lines! how do you introduce a bug like that,mickeysoft?

    anyhoo to get around that problem use this instead:

    PgUp::sendInput !{Space}el{PgUp}{Esc}

Get Free Articles in Your Inbox!

Join 134,000 newsletter readers

Email:

Go check your email!