Windows 7 – How to Set PowerShell Default Window Size

powershellwindows 7

In Windows 7, how can I set the default PowerShell window size? By default it comes up too tall for the netbook screen I am working with.

I have tried the usual way of changing the size—by clicking in the upper-left corner and choosing “Properties”—but it tells me: Unable to modify the shortcut: . Check to make sure it has not been deleted or renamed. (yes, there is a dot in the middle of the error message)

I also tried right-clicking on the PowerShell shortcut in the Start menu and changing properties there, however, the changes don’t seem to stick.

Best Answer

Use a function like this in your profile (notepad $profile)

Function Set-WindowSize {
Param([int]$x=$host.ui.rawui.windowsize.width,
      [int]$y=$host.ui.rawui.windowsize.heigth)

    $size=New-Object System.Management.Automation.Host.Size($x,$y)
    $host.ui.rawui.WindowSize=$size   
}

Then call the function:

Set-WindowSize 100 50