How to change Screen buffer size in Windows Command Prompt from batch script

后端 未结 14 1425
清歌不尽
清歌不尽 2020-12-02 09:59

I know you can do right click properties ->layout and there change it manually.

But how would you go about changing it from a Windows batch script?

I know yo

相关标签:
14条回答
  • 2020-12-02 10:37

    I was just giving a try for max lines on windows 7 i can set using mode con command and found it to be 32766 2^15-2 and you can set it with following command

    mode con lines=32766
    

    although you can set screen buffer size from the GUI too, but the max you can get is 9999.

    0 讨论(0)
  • 2020-12-02 10:38

    I have found a way to resize the buffer size without influencing the window size. It works thanks to a flaw in how batch works but it gets the job done.

    mode 648 78 >nul 2>nul
    

    How does it work? There is a syntax error in this command, it should be "mode 648, 78". Because of how batch works, the buffer size will first be resized to 648 and then the window resize will come but it will never finish, because of the syntax error. Voila, buffer size is adjusted and the window size stays the same. This produces an ugly error so to get rid of it just add the ">nul 2>nul" and you're done.

    0 讨论(0)
提交回复
热议问题