112

Is there a possibility to get "more" lines into the command window (Console)?

When I debug my programs I output quite a bunch of lines to the window and the beginning of the ouput keeps disappearing out of the range I can scroll back the window so I don't see my complete output from the beginning of the program.

How can I get the command window to keep all lines?

(And yes I could as well write it into a text-file as a log, but I'd like to try it like this for a change)

F.P
  • 17,421
  • 34
  • 123
  • 189
  • 1
    this is not a programming question. the answer, though is: yes: From the window: Alt-Space, 'p' for properties, it's on the first tab of that dialog. – Heath Hunnicutt Nov 16 '09 at 08:49

3 Answers3

190

At least in Win7, Kristina's answer now seems to be either its memory of commands typed in the command lines, or the amount you can copy-paste.

To increase the scrollbar's memory, I did the following:

  • Go to properties as mentioned by Kristina
  • Go to the layout tab (that's the third one)
  • Modify the screen buffer size's height - 9999 is the maximum.

As mentioned by Joey in the comments to Kristina's answer, this will not work on things you've already done - only on things you do after making the change.

This answer was originally written when Kristina's was marked as accepted. Now that this is the accepted answer, I've edited my answer to avoid confusion.

Scott Mermelstein
  • 15,174
  • 4
  • 48
  • 76
  • Sorry I didn't answer sooner; I answered in my head while driving, but never put the answer down. You probably should pose your question as a separate one, not that I'm trolling for points, but that a thorough answer would take more than 600 characters, and you could possibly add different tags to get better responses. – Scott Mermelstein Aug 26 '15 at 20:59
  • Off-the-cuff answers, though: It's not likely, using standard batch processing. The lines you can scroll back are part of the window encapsulating the command prompt, not the prompt itself. I looked in `cmd /?` and it made no reference to this. That said, I'm sure this value is stored somewhere in the registry, and you can change registry settings via command line, so it should be possible to do. I would question if that's really what you need, though, and I'm not sure it would alter the instance of the window you're currently running in. – Scott Mermelstein Aug 26 '15 at 21:03
  • 2
    Works on windows 10 – Alex Egli Mar 01 '17 at 20:35
33

Just to complement the answer(s) above, its also possible to export the lines to a txt file using > fileName.txt

For example:

myProgram.exe > output.txt // will create a new file with all the output of myProgram
Sergio
  • 28,539
  • 11
  • 85
  • 132
  • 2
    You can add "2>&1' to capture STDERR lines too. > myProgram.exe > output.txt 2>&1 it's from unix but for some reason works in cmd too. – mauromartini Apr 14 '20 at 19:28
14

If you're using windows , click on the CMD icon in the top left corner and go to properties.

Click the Options tab.

In Command History, type or select 999 in Buffer Size, and then type or select 5 in Number of Buffers.

Kristina
  • 15,859
  • 29
  • 111
  • 181
  • Does not seem to work, I still can't scroll to the top... seems like I output too much lines... – F.P Nov 16 '09 at 09:04
  • 1
    It doesn't affect stuff you already printed. What went out of the buffer is gone. You have to run your program again after the change. Also the maximum size for a buffer is 9999 lines, you might as well use that. – Joey Nov 16 '09 at 09:07
  • Okay, now it works, but only after I also changes the window buffer height to somewhat higher than it was. Thanks for the advice :) – F.P Nov 16 '09 at 09:10
  • 11
    This increases the command history that you can recall by pressing up (or F7), not the screen buffer size. Scott's answer is what you're looking for, I believe. – pancakes Jun 26 '13 at 19:04
  • please add a space between 'or' and 'select' – Mengfan Ma Apr 27 '19 at 13:41