Skip to content

Instantly share code, notes, and snippets.

@ChrisPritchard
Last active May 17, 2020 04:46
Show Gist options
  • Save ChrisPritchard/a87178329f6e13e483d681de461ccf18 to your computer and use it in GitHub Desktop.
Save ChrisPritchard/a87178329f6e13e483d681de461ccf18 to your computer and use it in GitHub Desktop.
# small powershell script that will move a window to a specified location.
# used (as can be seen in the code) to move a borderless 1920x1080 Skyrim SE window to the middle of my 3840x1080 screen.
add-type @"
using System;
using System.Runtime.InteropServices;
namespace WindowMethods {
public class Imported {
[DllImport("user32.dll")]
public static extern bool SetWindowPos(IntPtr hWnd, IntPtr hWndInsertAfter, int X, int Y, int cx, int cy, uint uFlags);
}
}
"@
# args are: window handle, what to put it behind (0 = nothing), x pos, y pos, br x (ignored), br y (ignored), flags (1 = don't resize)
[WindowMethods.Imported]::SetWindowPos( (Get-Process -Name SkyrimSE).MainWindowHandle, 0, 960, 0, 0, 0, 0x0001 )
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment