How to Automatically Erase the Paging File at Shutdown in Windows 11/10/8/7?

Posted by

Apart from Hibernate feature, Microsoft also offers Paging File (pagefile.sys) in Windows 11/10/8/7 to gear up or speed up Windows PC. A paging file, also known as a page file, is an additional virtual memory when your RAM fills up.

Whenever you shut down your computer or power losses, the system’s RAM is always erased; however, the page file isn’t. If you are working with some sensitive data and you’re worried about someone snooping for sensitive data that may be left in your page file, you can configure your Windows PC to erase it each time you shut down. Once you erase the page file and someone pulls the hard drive from your computer, they can’t examine the page file to find any potentially sensitive data that may have been stored in memory.

If you are not working with any sensitive data on your PC, it is not good for you to erase the page file at the PC’s shutdown. It is not recommended to erase the page file at shutdown as it will make your computer take much longer to shut down. Your shutdown time may go from a few seconds to a few minutes or even higher. It totally depends on how fast your computer’s hard drive is and how large your page file is. This is the actual reason Windows doesn’t automatically clear the page file at shutdown by default.

This post will guide you on automatically erasing the Windows Paging File at Shutdown in Windows 10/8/7. There are at least two methods through which you can erase the Windows Paging File at PC Shutdown; these are the following:-

  1. Erase the Windows Paging File at Shutdown using Registry Editor.
  2. Delete the Windows Page File at Shutdown via Group Policy Editor.

How to automatically erase the Windows Paging File at Shutdown in Windows 11/10/8/7 using Windows Registry Editor?

Note: Before using this method, we recommend taking a full backup of Windows Registry and creating a system restore point.

To automatically erase the Windows Paging File at Shutdown in Windows 10/8/7 using Windows Registry Editor, perform the following steps:-

Step 1. Start the Registry Editor by pressing Windows logo + R keys, typing regedit into the Run dialog that appears, and clicking the OK button.

Step 2. In the Registry Editor window that opens, navigate to the following key:-
HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management

Step 3. On the right side of Memory Management, double click the ClearPageFileAtShutdown to edit its value.

Step 4. Change the Value data from 0 to 1.

Step 5. Click OK.

Step 6. Close the Registry Editor window.

Now, when you shut down your computer, Windows will automatically erase the Windows Paging File or Page File.

How to automatically clear the Windows Paging File at Shutdown in Windows 11/10/8/7 using Group Policy Editor?

Note: Local Group Policy Editor (gpedit.msc) is not a part of any Windows Home edition. If you want to go through gpedit.msc in Home Edition Windows, you need to first enable the gpedit.msc in your Windows PC.

To automatically release the Windows Paging File at Shutdown in Windows 10/8/7 using Group Policy Editor, perform the following recommended steps:-

Step 1. Press and hold the Windows logo key, and then press the R key to open the Run dialog box.

Step 2. Type the following in the Run box and hit Enter from the keyboard to open the Local Group Policy Editor window:-


Step 3. In the Local Group Policy Editor window that opens, browse to the following path:-
Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options

Step 4. On the right-side pane of the Security Options, find the “Shutdown: Clear virtual memory pagefile” policy. Double-click on it to open its setting.

Step 5. Select the Enabled radio button.

Step 6. Click Apply.

Step 7. Click OK.

Once you complete the above steps, Windows 11/10/8/7 automatically erases the Paging File or Page File each time you shut down your PC.

If you want to prevent Windows from clearing your page file each time you shut down, on the above step 5, select the Disabled option.

That’s all!!!

Leave a Reply

Your email address will not be published. Required fields are marked *