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.

NewSoftwares.net editorial team · Published November 2026 · Last verified: November 2026 · 8 min read

Copy the batch file →Back to the main guide

Illustration of a terminal window, file and play icons around a command prompt graphic
At a glance
Applies toWindows 11 24H2, 25H2 and later
Time neededAbout 5 minutes to set up
DifficultyModerate; Notepad and one folder
CostFree
NeedsNotepad; no admin rights for your own key
Last verifiedNovember 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 0

Line 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>&1
Why this matters

The 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.

  1. Export the key. In Registry Editor, select RunMRU, choose File, then Export, and save the .reg file to the Desktop.
  2. Open Notepad and paste the batch file text.
  3. Save as clear-run-history.bat. In the Save as type box, pick All files.
  4. Test. Run notepad from 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.

0 of 4 checked
Not ready Finish the export and the extension check first.
Almost Complete the remaining items before the first run.
Ready Run the file and reopen the Run drop-down.

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.

Startup folder sequence: sign in, the file runs, the registry delete runs, Run list ends emptySign into WindowsStartupfolder.bat runsreg deleteEmptyRun listRuns once per sign-in, per account
The Startup folder runs the file at sign-in, so the list is empty before you open Run.
  1. Press Win + R, type shell:startup and press Enter.
  2. Copy the .bat file into the folder that opens.
  3. 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.

Sign-in versus scheduled clearing
OptionRunsBest for
Startup folderEvery sign-inPersonal PCs, simple setup
Task Scheduler dailyOnce a day at a chosen timePCs that stay signed in for days
Task Scheduler weeklyOnce a weekLight-touch tidying
Our pickStartup folderFewest 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.
Common mistake

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.

History Clean General Options screen with load on startup and clean on Windows shutdown tick boxes
General Options lists startup loading and cleaning at Windows shutdown.

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.

Where to download

Every NewSoftwares.net installer, History Clean included, is listed on the NewSoftwares.net downloads page.

Common question

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.