Home › Clear Run History with a Script in Windows 11
Clear Run History with a Script in Windows 11
Quick answerSave a .bat file that runs reg delete on the RunMRU key with the /va and /f switches, then double-click it or place it in the shell:startup folder to run at every sign-in. Export the key first, and skip automation on managed PCs.
| Applies to | Windows 11 24H2, 25H2 and later |
|---|---|
| Time needed | About 5 minutes to set up |
| Difficulty | Moderate; Notepad and one folder |
| Cost | Free |
| Needs | Notepad; no admin rights for your own key |
| Last verified | November 2026 |
A Three-Line Batch File for the Run List
A three-line batch file deletes every value under the RunMRU key and exits without a window. It runs under your own account, needs no elevation and leaves the key in place. Copy it into Notepad and save it with the .bat extension.
@echo off
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU /va /f >nul 2>&1
exit /b 0Line one hides command echo. Line two runs reg delete with /va for all values and /f to skip the confirmation, and sends any error output to nowhere so a missing key stays quiet. Line three ends the script cleanly.
File Explorer’s address bar keeps its own list. Add the line below under line two if you want to clear it too.
reg delete HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\TypedPaths /va /f >nul 2>&1The script clears only your account. Another user needs their own copy, run from their sign-in.
Create and Test the .bat File Safely
Creating the file takes four steps in Notepad and a two-minute test. Save the file with All files selected as the type, so Windows does not append .txt, and run it only after you export the RunMRU key as a backup.
- Export the key. In Registry Editor, select RunMRU, choose File, then Export, and save the .reg file to the Desktop.
- Open Notepad and paste the batch file text.
- Save as clear-run-history.bat. In the Save as type box, pick All files.
- Test. Run
notepadfrom Win+R, so one entry exists, then double-click the .bat file and reopen the drop-down. It should be empty.
Pre-run checklist
Tick each item before the first run.
Run the Script at Every Sign-in
Windows 11 runs items placed in the shell:startup folder each time the account signs in. Copy the .bat file there and the Run list empties at every sign-in with no extra software, no scheduler and no admin rights.
- Press Win + R, type
shell:startupand press Enter. - Copy the .bat file into the folder that opens.
- Sign out and back in, then open the Run drop-down.
To stop the clear, delete the file from that folder. Because the script runs at sign-in, it does not clear commands you type during the session; the list builds up again until the next sign-in.
Schedule the Script With Task Scheduler
Task Scheduler can run the batch file daily or weekly instead of at sign-in. Open Create Basic Task, choose a trigger, pick Start a program and browse to the .bat file; a one-time manual run proves the task works.
| Option | Runs | Best for |
|---|---|---|
| Startup folder | Every sign-in | Personal PCs, simple setup |
| Task Scheduler daily | Once a day at a chosen time | PCs that stay signed in for days |
| Task Scheduler weekly | Once a week | Light-touch tidying |
| Our pick | Startup folder | Fewest moving parts |
Set the task to run only when you are signed in, so it clears the right account’s key. A task that runs as another user would repeat the account-mismatch problem described in the guide to reappearing Run history.
Cautions Before You Automate Clearing
Automatic clearing removes information you may want later, including commands that explain a problem. Three habits keep it safe: keep a recent .reg backup, read the list before the first clear, and avoid automation on any PC your employer manages.
Safe habits
- Keep one dated .reg export.
- Review the list before the first run.
- Test on a spare account first.
Avoid
- Scripts on employer-managed PCs without approval.
- Running an unknown .bat file from the web.
- Clearing to hide activity from an investigation.
Pasting a command from a web page into Run and clearing the list afterward. Look at the entry first; a pasted command that you did not understand deserves a security scan.
A Cleaner With Shutdown Cleaning as an Alternative
History Clean offers a script-free route: its General Options screen has tick boxes to load the program at startup and to run cleaning operations on Windows shutdown. Its official page names Windows 10, 8, 7 and XP, so confirm it runs on Windows 11 first.

Pair the cleaner’s Windows Cleaning screen, where Run History is its own tick box, with the shutdown option to clear the list once per day without a script. The download is on the History Clean page, and the manual methods above remain the primary route.
Every NewSoftwares.net installer, History Clean included, is listed on the NewSoftwares.net downloads page.
Questions About the Clear Script
The script deletes every value under the RunMRU key for the account running it, which empties the Run drop-down. The /va switch targets values and /f skips the prompt. The key itself stays in place. A second line can clear the TypedPaths values for File Explorer’s address bar as well.
Press Win+R, type shell:startup and press Enter. Copy the .bat file into the folder that opens. Windows runs items there at sign-in for that account. Test by running a command from Run, signing out, signing back in and opening the drop-down to confirm it is empty.
Yes. Open Task Scheduler, choose Create Basic Task, pick a daily or weekly trigger, select Start a program and browse to the .bat file. Run the task once by hand to confirm the Run list empties, and set it to run only when you are signed in so the right account is cleared.
Only with your IT team’s approval. Security tools can log deletion of the RunMRU key, and an unexpected clear on a managed PC may raise an alert. Stay within your employer’s rules and keep a record of what you changed, so a question later has a plain answer.
Restore the .reg file you exported from the RunMRU key before running the script: double-click the file and confirm the prompt. Without an export, Windows cannot rebuild the entries itself. Delete the .bat file or the copy in the Startup folder to stop future clears from running.