Save & restore your entire Windows session with one command.
Because life's too short to reopen 20 windows after every reboot.
🇨🇳 中文 | 🇬🇧 English
# Install (one-time)
git clone https://github.com/Liyue2341/SnapBack.git
cd SnapBack && .\install.ps1
# Use (every time)
snapback save # before reboot
snapback restore # after reboot - everything comes backThat's it. Restart your terminal after install. Works from anywhere.
🖥️ GUI apps (WeChat, browsers, etc.) • ⌨️ Terminal processes (Python, Node, SSH, ngrok) • 🤖 Claude Code (every instance, correct directory, multi-instance support) • 📁 All open File Explorer windows
Auto-start apps (PowerToys, OneDrive, Notion...) are automatically excluded.
PS> snapback save
Capturing running processes...
Capturing Explorer windows...
Snapshot saved: 2026-03-28_143022
Processes captured: 14
Explorer folders: 4
PS> snapback restore
[OK] Weixin
[OK] claude @ D:\Projects\my-app
[OK] claude @ D:\Projects\backend (1/2)
[OK] claude @ D:\Projects\backend (2/2)
[OK] python @ D:\Projects\backend
[OK] ssh @ D:\Projects\server
Restoring Explorer folders...
[OK] D:\Projects\my-app
[OK] D:\Projects\backend
Restore complete: Restored 8, Folders 2
| Command | What it does |
|---|---|
snapback save |
Save current session |
snapback restore |
Restore latest snapshot |
snapback list |
List all snapshots |
snapback show |
Show snapshot details |
snapback save -Name dev |
Save with a custom name |
snapback restore -Name dev |
Restore a specific snapshot |
snapback delete -Name dev |
Delete a snapshot |
How It Works (click to expand)
- Queries running processes via WMI/CIM, filters out system/child/auto-start processes
- Detects real working directories by walking up the process tree to the parent shell and reading its CWD via the Windows PEB API (
NtQueryInformationProcess) - Captures open File Explorer windows via COM
Shell.Application - Saves everything as JSON
- GUI apps (browser, WeChat): skips if already running
- CLI tools (claude, python, node): matches by command-line arguments, supports multi-instance
- Relaunches each process with original arguments and working directory
- Reopens all Explorer folder windows
SnapBack/
├── snapback.ps1 # CLI entry point
├── config.json # Exclude lists & settings
├── install.ps1 # One-click global installer
└── lib/
├── Snapshot.ps1 # Process capture, CWD detection
└── Restore.ps1 # Smart restore with duplicate detection
Configuration (click to expand)
Edit config.json to customize:
Known Limitations
- Terminal scrollback / command history is not preserved — only running processes
- Window positions and sizes are not restored (yet)
- Windows Terminal tabs restore as individual processes, not grouped tabs
- SSH sessions requiring interactive auth will prompt for credentials again
PRs and ideas welcome!
If SnapBack saved you from the "15-minute workspace rebuild ritual":
MIT License • Built with frustration and PowerShell
⭐ Star if you've been there too
{ "excludeProcesses": [...], // System processes to ignore "autoStartProcesses": [...], // Apps that restart on their own "excludeArgPatterns": [...], // Filter by command-line patterns "maxSnapshots": 20, // Auto-cleanup old snapshots "restoreDelayMs": 500, // Delay between launches (ms) "confirmBeforeRestore": true // Prompt before restoring }