CMD: Set buffer height independently of window height

前端 未结 6 493
情话喂你
情话喂你 2020-12-05 06:17

I\'ve recently learned that I can control the size of the CMD window running my program with mode x,y. However I just as recently noticed that this sets the

6条回答
  •  既然无缘
    2020-12-05 06:23

    here another variant:

    /*
    @echo off & mode 100,50
    set "cscfile="
    set Pathfile="%WinDir%\Microsoft.NET\Framework\csc.exe"
    for /f "delims=" %%a in ('dir /b /a-d /s %PathFile%') do set "cscfile=%%a"
    if defined cscfile (
      %cscfile% /nologo /out:"%~0.exe" %0
    ) else exit /b
    "%~0.exe"
    del "%~0.exe" 
    cmd /k
    */
    
    using System;
    
    class Program
      {
         static void Main()
         { 
            Console.SetBufferSize(100, 9999); 
            Console.ForegroundColor = ConsoleColor.Green;
            Console.WriteLine("Current Logged UserName: " + Environment.UserName);
            Console.ResetColor();
            Console.WriteLine("[Enter] to continue");
            Console.ReadLine();
         }
      }
    

提交回复
热议问题