How To Control Text Scrolling When Using Windows Command Prompt

1

winlogo.jpgHave you ever entered a command at the prompt only to have the text scroll by so fast that you had no idea what was returned by the command? You can always use the scroll bar to navigate back up (or use your mouse scroll wheel) to see the information returned by the command.

But in some cases, so much text was returned that it exceeds the screen buffer size and rolls off the screen. Especially when you are viewing text files from logs or error outputs.

So how can you control the amount of text that can be viewed from the command prompt?  By using the more command.

The more command easily allows you to control scrolling text by stopping the scrolling one page at a time.

Before we get started, the command examples shown below uses the pipe symbol (character) which can be entered by pressing SHIFT+Backspace (above ENTER key).

Now that's out of the way, let's continue.

Say you wanted to list the contents of the System32 directory while viewing the results one page at a time. Just enter the following command at the prompt.

dir c:\windows\system32 | more

And the text will stop scrolling at the first page. To continue scrolling, press the Space bar once, for each time you want to scroll through the pages.

Now that you can scroll one page at a time, you can stop or break out of the more command by pressing the Q key.

To control exactly what you want to see, you can also display or skip how many lines of text you want to view.

To do this, use the following options with the more command:

P n Display next n lines
S n Skip next n lines

For example using the above dir (directory) command, after the first page of text has stopped scrolling, instead of pressing the Space bar, press either the P or S key (depending on if you want to display or skip a number of lines).

You will see the word Lines and a semicolon. To skip the next four lines, press the S key, followed by pressing the number 4 key. Then press Enter.

To display the next four lines, just press P and follow the steps above for skipping lines.

Now that you can control scrolling text from a command, how about displaying text from a file?

To do this, just use the following command syntex.

more filename

For example to view a file named, mycdrive.txt, you would enter the following command at the prompt:

more mycdrive.txt

Windows will automatically put you in the more mode and you can use all the commands shown above to control text scrolling.

If you want to view which line you are at in the text file, press the = (equal) key on the keyboard.

If you ever forget what options to use with the more command, just type more /? at the prompt to see all available options.

Now that you know how to control text scrolling, using Windows command prompt has just become a little easier!

Comments on How To Control Text Scrolling When Using Windows Command Prompt Leave a Comment

July 25, 2012

Aceleron @ 11:35 am #

Tranks, very usefull.

Leave a Comment

Fields marked by an asterisk (*) are required.

Subscribe without commenting