Skip to main content

Clear Windows Run command history

Overview

About this script

This script improves your privacy on Windows.

These changes use Windows system commands to update your settings.

This script clears the Most Recently Used (MRU) list in Windows Run.

Windows Run is a utility that allows users to quickly open programs, files, folders, and web pages 1 2 3. It's also known as the Windows Run dialog box 2 4, Windows Command Window 3, Windows Run Box 5, Windows Run utility 1 6, and Windows Run window 1.

You can access it by:

  • Pressing Windows logo key + R 1 3
  • Searching for Run in the Start Menu 1 2
  • Running specific commands:
    • explorer shell:::{2559a1f3-21d7-11d4-bdaf-00c04f60b9f0} 4
    • SYSTEMROOT%\System32\rundll32.exe shell32.dll,#61 4

Keeping this data poses privacy and security risks:

  • It reveals user activity on the system, including accessed files and applications 1 5 6
  • Forensic analysts use this data to study user behavior 1 5 6
  • Attackers use this data to understand user activities or execute malicious code 5

Clearing this data improves your privacy and security by:

  • Removing traces of your recent activities
  • Preventing third parties from gaining insights into your system usage
  • Reducing the risk of malicious code execution via manipulated data entries

It can also improve system performance by reducing the amount of data Windows needs to process when accessing the Run dialog history.

This script deletes all registry values under HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU 1 5 6.

To ensure the changes take effect, close and reopen the Run window if it's currently open 1.

Caution

This script will erase your Run command history, potentially slowing down access to frequently used programs and files.

This script uses Batch (batchfile) scripting language.

Safe for General Use

This script is recommended for all users. It helps to improve privacy without affecting stability.

Implementation Details
  • Language: batch

  • Required Privileges: Administrator rights

  • Compatibility: Windows only

  • Reversibility: Some changes may be permanent

Explore Categories

This action belongs to Clear recent activity category. This category includes scripts that erase traces of recent user activities on Windows. These scripts enhance privacy by removing records of accessed files, used applications, and changed system settings. Clearing recent activity is crucial for protecting your privacy. Your computer keeps... Read more on category page ▶

Apply now

Choose one of three ways to apply:

  1. Automatically via privacy.sexy: The easiest and safest option.
  2. Manually by downloading: Requires downloading a file.
  3. Manually by copying: Advanced flexibility.

Alternative 1. Apply with Privacy.sexy

privacy.sexy is free and open-source application that lets securely apply this action easily.

Open privacy.sexy

privacy.sexy instructions
  1. Open or download the desktop application
  2. Search for the script name: Clear Windows Run command history.
  3. Check the script by clicking on the checkbox.
  4. Click on Run button at the bottom of the page.

Alternative 2. Download

Reversible

This script is reversible, you can restore your changes to the initial/default state. The restore/revert methods provided here can help you fix issues.

If something goes wrong, use the Revert script provided above.

  1. Download the script file by clicking on the button below:

    Download script

  2. Run the script file by clicking on it.

Alternative 3. Copy

This is for advanced users. Consider automatically applying or downloading the script for simpler way.

  1. Open Command Prompt as administrator.
HELP: Step-by-step guide
  1. Click on Start menu

  2. Type cmd

  3. Right click on Command Prompt select Run as administrator

  4. Click on Yes to run Command Prompt


Animation showing how to open terminal as administrator on Windows 11

  1. Copy the following code:
Code to apply changes
:: Clear register values from "HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU" 
PowerShell -ExecutionPolicy Unrestricted -Command "$rootRegistryKeyPath = 'HKCU\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU'; function Clear-RegistryKeyValues { try { $currentRegistryKeyPath = $args[0]; Write-Output "^""Clearing registry values from `"^""$currentRegistryKeyPath`"^""."^""; $formattedRegistryKeyPath = $currentRegistryKeyPath -replace '^([^\\]+)', '$1:'; if (-Not (Test-Path -LiteralPath $formattedRegistryKeyPath)) { Write-Output "^""Skipping: Registry key not found: `"^""$formattedRegistryKeyPath`"^""."^""; return; }; $directValueNames=(Get-Item -LiteralPath $formattedRegistryKeyPath -ErrorAction Stop | Select-Object -ExpandProperty Property); if (-Not $directValueNames) { Write-Output 'Skipping: Registry key has no direct values.'; } else { foreach ($valueName in $directValueNames) { Remove-ItemProperty -LiteralPath $formattedRegistryKeyPath -Name $valueName -ErrorAction Stop; Write-Output "^""Successfully deleted value: `"^""$valueName`"^"" from `"^""$formattedRegistryKeyPath`"^""."^""; }; Write-Output "^""Successfully cleared all direct values in `"^""$formattedRegistryKeyPath`"^""."^""; }; } catch { Write-Error "^""Failed to clear registry values in `"^""$formattedRegistryKeyPath`"^"". Error: $_"^""; Exit 1; }; }; Clear-RegistryKeyValues $rootRegistryKeyPath"
  1. Right click on command prompt to paste it.
  2. Press Enter to apply remaining code.

Support

This website relies on your support.

Support now

Your donation helps keep the project alive and improves its content ❤️.

Share this page: