Windows Automation Scripts
Three small Windows scripts that remove repeat chores: two for switching monitors, one for safely moving AI chat history to a bigger drive.
My role
Mohamad decided what to automate (a one-monitor mode for ranked games, and moving chat history off a full drive). Claude (AI) wrote the scripts under his direction; he tests and uses them.
What it is
These are three short scripts on the desktop of a PC used for both Roblox development and ranked gaming. Two are one-line wrappers around the built-in Windows display switcher. The third is a defensive migration script for a folder of AI chat transcripts.
The interesting one is the migration. It will not run if the app is open, only copies files and never deletes, aborts on a robocopy error, keeps the original as a backup, then links the old path to the new location so the app keeps working unchanged.
These are small tools, not a software product. They show a habit of treating his own workflow as something to engineer, with AI doing the typing.
How it was built
- Spot the frictionSwitching to a single monitor before a game needed several clicks, and the chat history folder was filling the system drive.
- Game Mode script (3 lines)Game Mode - 1 Monitor.bat calls DisplaySwitch.exe /internal so only the main screen stays on and games and Windows see one monitor.
- Restore script (3 lines)Duplicate All Monitors.bat calls DisplaySwitch.exe /clone to go back to duplicated displays.
- Migration script: guardFinish Claude chat move.cmd (13 lines) first runs tasklist and refuses to continue if the Claude app is still running.
- Migration script: copy onlyIt then robocopies the chat project folder to a folder on the D: drive with /E /COPY:DAT and one retry, and never deletes anything at the destination.
- Migration script: stop on failureIf robocopy returns an exit code of 8 or more, the script prints that nothing changed and stops.
- Migration script: swap safelyThe original folder is renamed to projects.bak (stopping if a file is still open), then a directory junction is created at the old path pointing to the new location.
- Keep a way backThe script tells the user the backup stays until the app looks right, and only then should it be deleted.
Decisions and why
- Wrap built-in Windows tools instead of writing custom code
- DisplaySwitch.exe already does the job; three lines are easier to trust than a program.
- Copy first, rename second, never delete
- If anything fails mid-way, the original chats are still there.
- Use a junction at the old path
- The app keeps reading the old location, so nothing else needs reconfiguring.
Hardest problems
- Moving a live data folder without losing history
- Refuse to run while the app is open, copy before rename, abort on robocopy codes 8 and above, keep a .bak copy until verified.
Numbers
| Lines in Game Mode - 1 Monitor.bat | 3 | 2026-11-06 |
|---|---|---|
| Lines in Finish Claude chat move.cmd | 13 | 2026-11-06 |
| Robocopy failure threshold used | exit code 8 or higher stops the script | 2026-11-06 |
Timeline
- October 2026Scripts created as part of PC workflow and storage clean-up (exact dates not read)
What I took from it
- Small scripts are worth writing when they remove a daily annoyance.
- Safe migrations check preconditions, copy before renaming, and keep a backup.
- AI can write the script, but the owner has to know which failure cases matter.