# PersistentWindows: automatic window position restore for multi-monitor Windows setups

> PersistentWindows is a Windows utility that tracks window positions and restores them automatically after monitor changes, sleep events, or RDP reconnections. It installs via winget and requires administrator privileges to restore windows with elevated rights.

**kangyu-california/PersistentWindows** — fork of http://www.ninjacrab.com/persistent-windows/ with windows 10 update

- Repository: https://github.com/kangyu-california/PersistentWindows
- Stars: 2,072 · Forks: 72
- Language: C#
- License: GPL-3.0
- Published: 2026-10-11 · Updated: 2026-10-11 · Language: en
- Canonical page: https://hysenlabs.com/projects/kangyu-california-persistentwindows

## Windows repositions open windows after monitor events; PersistentWindows undoes that automatically

Windows 7, 10 and 11 have a long-standing behavior where open application windows get repositioned whenever the monitor configuration changes. Triggering events include the system waking from sleep, connecting or disconnecting an external monitor, resolution changes from exiting a full-screen game, and RDP session reconnections. After any of these, windows that were precisely arranged across multiple monitors end up stacked on the primary display or in wrong positions.

PersistentWindows is a fork of the original utility from ninjacrab.com, updated to handle Windows 10 and 11 specifically. It watches the window positions continuously and restores the desktop layout to the last matching monitor setup when a disruption occurs. Taskbar position is included in what it restores, not just application windows.

## Position history writes to XML on disk; snapshots start in RAM but survive reboots through that same store

PersistentWindows stores the location history of every window, whether alive or closed, to disk in XML format. The README describes this as the mechanism that lets both auto-restore and manual snapshot restore continue working across program restarts and PC reboots. That XML store is the persistent layer underneath the entire position-tracking system.

Snapshots are described separately as saving the desktop layout 'to ram', which on its own could lead a reader to expect they disappear at shutdown. The README also states that the XML-persisted location history ensures manual restore points continue working even after a PC reboot. Taken together, the snapshot identifiers and their associated position data carry over through the XML store, so the 'saved to RAM' description describes where snapshots live during a session, while the XML history is what keeps them available across reboots.

This distinction matters for any workflow that depends on named restore points surviving a system restart. The on-disk XML format is readable and lives in the same data directory as the LiteDB captures.

## winget or zip: two install paths and the data directory at AppData\Local\PersistentWindows

Two install methods are documented. The winget method is the simpler one:

```bash
winget install PersistentWindows
```

After installation, open a new command window and type PersistentWindows to start the program. The winget install path is C:\users\[user]\AppData\Local\Microsoft\WinGet\Packages\kangyu-california.PersistentWindows, which the README notes with the exact path format including the trailing dots.

The zip method involves downloading PersistentWindows*.zip from the GitHub Releases page, unzipping to any directory, and running PersistentWindows.exe from there. Regardless of which install method is used, the program saves its data to C:\Users\[User]\AppData\Local\PersistentWindows. That path is fixed and cannot be changed through the documented options.

For PersistentWindows to restore windows belonging to elevated-privilege applications like Task Manager or Event Viewer, the program itself must be run with administrator privileges. Without that, it still tracks and restores regular windows, but elevated windows are out of reach.

## Three methods to auto-start on login; the Startup folder requires a .vbs script for admin rights

Windows shortcuts in the Startup folder cannot be set to run as administrator in a way that takes effect through that folder. The README notes this explicitly and offers a .vbs workaround. The script uses Windows Script Host to invoke PersistentWindows.exe with the 'runas' verb:

```vbscript
Set objShell = CreateObject("Shell.Application")
objShell.ShellExecute "C:\path\to\PersistentWindows.exe", "", "", "runas", 1
```

The path in the script must be updated to match the actual installation directory before placing the .vbs file in the Startup folder at shell:startup.

A more direct approach uses Task Scheduler. For Windows 10 and 11, running auto_start_pw.bat as administrator creates the scheduled task automatically. For broader compatibility across Windows 7, 10 and 11, the schtasks command creates the task at the highest privilege level:

```bash
schtasks /create /sc onlogon /tn "StartPersistentWindows" /f /tr "'%~dp0pw.bat'" /rl HIGHEST
```

The REG ADD line that follows in the README sets the HIGHDPIAWARE flag in the AppCompatFlags registry key for PersistentWindows.exe, which handles DPI scaling on high-resolution displays.

## LiteDB captures for closed windows and up to 36 RAM snapshots per display configuration

Manual save has two separate mechanisms that store to different formats. Disk captures write the current desktop layout to LiteDB format, which preserves window positions through reboots and covers windows that are subsequently closed. After a PC restart, closed windows can be restored to the corresponding virtual desktop using a saved disk capture. The LiteDB file is part of the AppData\Local\PersistentWindows data directory.

Snapshots are the faster alternative: they save the current desktop state to memory and preserve the window Z-order, which captures to disk do not mention preserving. Up to 36 snapshots are available per display configuration, identified by the characters [0-9a-z], giving 10 digit slots and 26 letter slots for a total of 36 named points. These can be restored through the right-click menu on the system tray icon.

The Z-order detail is the difference that matters in practice. If the relative stacking of windows matters as much as their positions, a snapshot captures that stacking while a disk capture does not specify doing so.

## Webpage commander and dual-position window switching target keyboard-focused workflows

PersistentWindows includes a webpage commander that adds one-letter commands in the style of the vi editor to all major web browsers. The README points to a webpage_commander.md file in the repository for the full command list. The feature aims to reduce mouse use during web browsing by letting users trigger navigation and tab management through single keystrokes.

A separate feature covers efficient window switching between a foreground position and a background position. The README calls these 'dual positions', meaning a window can toggle between two remembered locations rather than requiring a manual drag each time.

Both features sit inside the same binary as the core position-restore system. Disabling advanced features with the -basic_features flag leaves only the auto-restore and snapshot functions active, which is documented in the optional second line of auto_start_pw_aux.ps1.

## What PersistentWindows records about your windows and processes

The privacy statement in the README names eight data categories PersistentWindows collects: position, size, Z-order, caption text, window class name, process ID, command line, and Ctrl/Alt key state. Of these, the command line field is the one with the broadest potential footprint. Process arguments routinely include file paths and user-specific directory names, and in some development workflows they include environment variables or credentials passed on the command line. Any environment where argument visibility is controlled should account for that before adopting PersistentWindows.

Uninstall is a two-step process. First run uninstall.bat as administrator, which removes the AppData\Local\PersistentWindows directory and the auto-start scheduled task. Then either delete the installation directory or run winget uninstall to remove the binary. The two steps are kept separate so the data removal can happen independently from the binary removal.

The repository was last updated on 2026-10-02. It is a GPL-3.0 project.

## Conclusion

PersistentWindows suits Windows 10 and 11 users who regularly work across multiple monitors or frequently connect and disconnect external displays, and who accept that the program stores window captions, process IDs and command lines as part of its tracking. For full functionality with elevated windows like Task Manager, run it with administrator privileges. Anyone wanting only the auto-restore behavior can pass the -basic_features flag to PersistentWindows.exe, documented in auto_start_pw_aux.ps1. Verify the system tray icon appears after the first run: the icon is hidden by default and only shows the menu when right-clicked.

## FAQ

### What does PersistentWindows do?

PersistentWindows tracks window positions and restores the desktop layout automatically after monitor changes, system sleep events, or RDP reconnections. It also supports manual snapshots and disk captures for restoring window arrangements after a reboot.

### How do I install PersistentWindows?

Run winget install PersistentWindows from a command window, then open a new command window and type PersistentWindows to start it. An alternative is to download the zip from the GitHub Releases page, unzip it to any directory, and run PersistentWindows.exe directly.

### Does PersistentWindows need administrator rights?

Administrator privileges are needed to restore windows belonging to elevated-privilege applications such as Task Manager or Event Viewer. Without them, PersistentWindows still tracks and restores regular windows.

### Can PersistentWindows save and restore window positions after a reboot?

Yes. Disk captures save the desktop layout in LiteDB format and survive reboots. Snapshot positions are preserved through the XML location history on disk, so restore points continue to work after a PC restart.

### Does PersistentWindows work on Windows 11?

The README covers Windows 7, 10 and 11 and the auto_start_pw.bat method for Task Scheduler is noted specifically for Windows 10 and 11. Version 5.77 is the most recent release.

## Sources

- [Issues](https://github.com/kangyu-california/PersistentWindows/issues)
- [kangyu-california/PersistentWindows on GitHub](https://github.com/kangyu-california/PersistentWindows)
- [License: GPL-3.0](https://github.com/kangyu-california/PersistentWindows/blob/master/LICENSE)
- [README](https://github.com/kangyu-california/PersistentWindows/blob/master/README.md)
- [Releases](https://github.com/kangyu-california/PersistentWindows/releases)

---

Hysen Labs editorial analysis, written from the project's own repository and release notes. Cite the canonical page: https://hysenlabs.com/projects/kangyu-california-persistentwindows
