guidox / PC

Find and Move an Application Window That Opened Off Screen

TL;DR

Press **Alt+Space** then **M**, then an arrow key, to drag the window back. If the app has no system menu, move it with **SetWindowPos** through PowerShell.

Before you start

Requirements

  • The app that opens off screen
  • The second monitor disconnected
  • 10 minutes
Step by step

Instructions

01

Confirm the window exists

Task Manager shows the process and the window count even when nothing is visible. A process with a main window handle is running, but its window is off screen.

Get-Process | Where-Object MainWindowTitle | Select-Object Name,Id,MainWindowTitle
Get-Process notepad | Select-Object Id,MainWindowHandle,Responding
02

Use the system menu first

**Alt+Space** opens the window menu, **M** starts Move mode, and one arrow key attaches the window to the cursor. This works without any tooling and for most classic apps.

:: select the app in the taskbar
:: press Alt+Space
:: press M
:: press any arrow key, then move the mouse
03

Move it with a script when the menu is gone

Modern apps often have no system menu. **SetWindowPos** places the window at exact coordinates on the primary display, no matter where it thinks it belongs.

Add-Type @'
using System;
using System.Runtime.InteropServices;
public class Win {
  [DllImport("user32.dll")] public static extern bool SetWindowPos(IntPtr h, IntPtr a, int x, int y, int cx, int cy, uint f);
  [DllImport("user32.dll")] public static extern bool ShowWindow(IntPtr h, int c);
}
'@
$p = Get-Process notepad | Select-Object -First 1
[Win]::ShowWindow($p.MainWindowHandle, 9)
[Win]::SetWindowPos($p.MainWindowHandle, [IntPtr]::Zero, 100, 100, 900, 600, 0x0040)
04

Find the coordinates it is using

The window position lives in the app's own settings, in the registry, or in a config file. Knowing the stored value explains why it lands off screen after a monitor change.

Get-CimInstance Win32_DesktopMonitor | Select-Object Name,ScreenWidth,ScreenHeight
Get-CimInstance -Namespace root\wmi -ClassName WmiMonitorBasicDisplayParams | Select-Object InstanceName,MaxHorizontalImageSize
Add-Type -AssemblyName System.Windows.Forms
[System.Windows.Forms.Screen]::AllScreens | Select-Object DeviceName,Bounds
05

Reset the app's saved layout

Deleting the window placement value makes the app start centred on the primary display. Many programs store it under **HKCU\Software\...\WindowPlacement**.

reg query "HKCU\Software" /s /f WindowPlacement /k 2>$null | Select-Object -First 10
# or reset the whole layout for one app
Remove-Item "$env:APPDATA\Notepad\window.xml" -ErrorAction SilentlyContinue
Get-ChildItem "$env:APPDATA\Notepad" -ErrorAction SilentlyContinue
06

Stop it from happening again

Windows remembers per-display positions and restores them when the display returns. Disconnecting a monitor while an app runs is the usual trigger; closing the app before unplugging avoids it.

Get-PnpDevice -Class Monitor | Select-Object FriendlyName,Status,InstanceId
getdisplay.exe /listdevices 2>$null
# unplug the second monitor only after closing the apps that live on it
Troubleshooting

Common issues

Alt+Space does nothing

The window is a modern app without a system menu, or focus is elsewhere. Click the taskbar button first, then use the script.

The window appears but is tiny

The saved size is smaller than the current display scaling. Resize it once with the mouse; the app stores the new size.

The app still opens off screen after a reset

A second config location holds the value, often HKCU\Software\Vendor\App. Search the registry for the app name and check the position entries.

The window opens on the wrong monitor every time

The app is pinned to a display ID that changed. Move it while both monitors are attached, close it, then detach the second one.

FAQ

Frequently asked

Why does Windows not fix this itself?

It validates the position against the displays present at start-up, but an app that restores its own saved coordinates can bypass that check.

Does this work for games?

Fullscreen games manage their own display. Use Alt+Enter to leave fullscreen, then the window rules apply.

Is unplugging a monitor while apps run harmful?

No, but it is the cause of the problem. Close the apps first and the layout stays valid.

How to undo this

Nothing was changed permanently. If you deleted an app's window placement file, the app recreates it with default values on the next start.

Changelog · 1 entry
  1. 2026-11-01
    First version
Interactive version: checklist, feedback, related guides →

Free · no account needed · tracks your progress