Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I like to have a 2x2 grid of powershell windows open on my alternate monitor, but I'd prefer not to have to open and resize each one by hand. I can set the window size (through (Get-Host).UI.RawUI.WindowSize), but it appears that (Get-Host).UI.RawUI.WindowPosition is actually the scroll position within the buffer.

Does anyone know of any way to do this through PS scripting, or, failing that, through the Windows Scripting Host?

share|improve this question
You might need to use Add-Type to access some Windows API functions via C# to achieve that. – Joey Jun 30 '10 at 15:50
If you want a non-code solution, in Vista and 7 you can right-click on the taskbar and choose 'show windows side by side' – Jonno_FTW Jun 30 '10 at 17:08
up vote 3 down vote accepted

Asking the question prompted me to change my Google query string, and I've stumbled upon the correct way to do this.

First, download WASP. Make sure Import-Module Wasp is in your profile.

Then I created this script (appropriate for a pair of 1920x1200 monitors, with the "main" monitor being on the right):

# the pause is necessary to make sure the powershell consoles have
# had time to create their windows before attempting to move them
start (which powershell)
$g0x1 = start (which powershell) -PassThru
$g1x1 = start (which powershell) -PassThru

pause 2

set-windowposition -window ((get-process -id $ -left -1168 -top 0 -height 598
set-windowposition -window ((get-process -id $ -left -1168 -top 600 -height 598

The pause function is simply:

function pause
   wait-event -timeout $p
share|improve this answer
Even better, I now use ConEmu, which has nice splitter functionality built in. – moswald Sep 2 '14 at 23:05

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .