Changing Console Window's size throws ArgumentOutOfRangeException

前端 未结 4 1078
有刺的猬
有刺的猬 2021-01-07 19:39

I am trying to set the size of the Console Window in a c# console application. I get an ArgumentOutOfRangeException with this message:

Th

4条回答
  •  既然无缘
    2021-01-07 19:55

    Microsoft recently published some information around this, see:

    1. Understanding Windows Console Host Settings

    Try this in powershell:

    $windowSize = $(get-item hkcu:\console).GetValue("WindowSize")
    $windowHeight = $windowSize -shr 16
    $windowWidth = ($windowSize -shl 16) -shr 16
    

提交回复
热议问题