Console application leaves cmd.exe size

I wrote a console application that sets the size of the console and output buffer. My problem is that after the program finishes, I cannot resize the cmd.exe window the way I did before. After the program sets the size of the window, it keeps that size no matter what I do next.

0


source to share


3 answers


This works for me in C #.

namespace CSharpTest
{
    class Program
    {
        static void Main(string[] args)
        {
            System.Console.WindowHeight = 50;
            System.Console.WindowWidth = 100;
            System.Console.BufferHeight = 6000;
            System.Console.BufferWidth = 100;
        }
    }
}

      



After running the program, I can change the height of the window and make it narrower as before. I can't make it wider, but then I couldn't either.

+1


source


It's not clear what you mean. But are you setting default values ​​for all Cmd consoles when resizing. This would also create new console consoles.



Could we get a little more information on what you mean.

0


source


I believe the problem is that it starts the program from cmd.exe, then the console is resized. After exiting the console, the console remains in setup. I would try to keep the original settings and revert them just before exiting the program.

0


source







All Articles