32

Say you have a program that gives a lot of output. It seems that Command Prompt unfortunately doesn't keep all of it (there's only so far you can scroll up).

Is there a way to keep all of it?

6 Answers 6

31

Increasing the buffer size is the best way if you just want to scroll up and see the output, which you can configure in properties.

If you are appending to a file, you'll also probably want the errors in case there are any:

C:\>somecommand.exe > "C:\path\to\output.txt" 2>&1

If you want a pager, there is more or less for Windows.

example:

C:\>somecommand.exe | less

you can then use f to page forward or b to go backward.

6
  • Most comprehensive answer, I think. At it just happens to be John T. What do you know.
    – Nathaniel
    Jan 29, 2010 at 20:23
  • @Nathaniel, is that a bad thing =[] ... :)
    – user1931
    Jan 30, 2010 at 2:32
  • Nah, I just like to poke you and Molly. I don't think I'd actually like that many points. Doesn't look as pretty by one's name.
    – Nathaniel
    Jan 31, 2010 at 1:14
  • @JohnT, What are the cmd commands (as opposed to UI) to increase the buffer size?
    – Pacerier
    Aug 25, 2015 at 10:27
  • 1
    FYI, you need to configure Layout > Screen Buffer Size > Height, not Options > Command History > Buffer Size. Jul 26, 2016 at 13:58
9

To just capture output to a file, see other answers. You can also increase the amount to text you can scroll back and see up to a limit.

With the command prompt window open, click the [C:] icon in the title bar to bring up the menu and select properties. Under the Layout tab, change the Screen Buffer Size->Height to 9999. That will allow you to scroll back that many lines in the window.

8

Are you using Windows XP if so you could append to your command | more

Alternatively you could use

command redirection operators

.
This page has more info for you.

1
  • 3
    more exists since the Dark Ages of DOS ...
    – Joey
    Mar 31, 2010 at 7:44
6

Output the results to a file, like this:

C:> RunMyProgram.exe > outputfile.txt
2
  • +1 I was going to answer this but I was looking for a better way and didn't see one. You could increase the buffer size to 999 and number of buffers to 999, but depending on how large "a lot of output" is this may not be practical, especially when you go to save it out. You your program requires user interaction you would have to read the text file to know what the question is so you can answer it. Too bad Windows doesn't have a way to dump a log and keep the display buffers normal. Jan 22, 2010 at 3:37
  • @Scott: The number of output buffers is irrelevant for how many lines can be displayed. In a way they're like frame buffers for graphics; you can write to them and switch the display to another one. The buffer size, however, goes up to 9999 which should suffice for most needs.
    – Joey
    Mar 31, 2010 at 7:50
3

you can increase the buffer size on command history (defaults to 50) on properties. you could try to something like 500 or even 5000, than you should be able to scroll up a lot more.

another way is to redirect the output to a file using the ">" char:

ex:

C:> someCommand > output.txt

than open the txt file and you should see the output for the command there.

1

This question is old, but I'd like to add a newer Windows feature as an option. As stated in other answers, Less and More are easy to use, but if you need ultimate flexibility, you can redirect the stdout stream to a file with >. However, this leaves messy temporary files behind. Since Windows Vista, you can instead pipe the stdout stream directly to the clipboard with the clip command, like this:

c:\> someprogram.exe param1 param2 | clip

With that, you can then paste the output of the program or command into Notepad or other editor, do searches, make notes, copy or save elsewhere, etc. When you're done, just close the editor and it's gone with no cleanup necessary.

Note that if you're using CMD, this |clip command will not pass a newline at the end. In PowerShell, it will. If you want to do this in PowerShell without the newline, you can use |scb instead. This is a short alias for the Set-Clipboard cmdlet. |clip is available in both CMD and PowerShell. |scb is available only in PowerShell.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .