The Windows 11 Clipboard History feature (accessed by pressing Windows Key + V) is an incredibly powerful productivity tool. It allows you to copy multiple snippets of text, images, and links, storing them in a localized cache so you can paste them sequentially without constantly switching back and forth between applications.
However, this feature is also a massive privacy vulnerability. If you copy a password, a credit card number, or a sensitive personal email, that data sits in your Clipboard History completely unencrypted. If you share your computer with a family member or coworker, the next person to log in can simply press Windows Key + V and instantly view every sensitive item you copied during your session.
While you can manually click the “Clear all” button in the clipboard menu before you log off, it is incredibly easy to forget. Instead, you can use the Windows Local Group Policy Editor to run a silent script that automatically purges your entire clipboard history the moment you shut down your PC.
Step 1: Create the Batch Script
First, we need to create a simple script that forcefully clears the system clipboard cache.
- Right-click anywhere on your Desktop, select New > Text Document.
- Name the file
ClearClipboard.bat(ensure you delete the.txtextension). If Windows warns you about changing the file extension, click Yes. - Right-click
ClearClipboard.batand select Show more options > Edit (or open it with Notepad). - Paste the following command exactly as written:
cmd.exe /c "echo off | clip" - Press Ctrl + S to save the file, and then close Notepad.
- Move this file to a safe, permanent location where it won’t be accidentally deleted, such as your
C:\Windows\System32folder or directly in the rootC:\drive.
Step 2: Open the Local Group Policy Editor
Note: The Group Policy Editor is only available in Windows 11 Pro, Enterprise, and Education editions. If you are using Windows 11 Home, you cannot proceed with this step.
- Press the Windows Key + R to open the Run dialog box.
- Type
gpedit.mscinto the text box and press Enter.
Step 3: Assign the Script to the Shutdown Trigger
We need to tell Windows to execute our script during the final stages of the log-off process.
- In the left-hand navigation pane of the Group Policy Editor, navigate to: User Configuration > Windows Settings > Scripts (Logon/Logoff).
- In the right-hand pane, double-click on Logoff.
- A new “Logoff Properties” window will appear. Click the Add… button.
- Click Browse… and navigate to the location where you saved your
ClearClipboard.batfile (e.g., your C: drive). Select the file and click Open. - Leave the “Script Parameters” box completely blank.
- Click OK to add the script, then click Apply and OK on the main properties window.
Step 4: Test the Automation
Close the Group Policy Editor.
To verify the automation works, press Windows Key + V and ensure you have several items populated in your clipboard history. Then, completely restart or log off your Windows 11 PC. When you log back in, press Windows Key + V again. The clipboard menu will pop up, but it will be completely empty, guaranteeing that your sensitive copied data is wiped clean at the end of every session.