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

In addition to the Hibernate feature, Windows 11/10/8/7 offers the Paging File (pagefile.sys) to optimize or accelerate the performance of your PC. This file serves as additional virtual memory when your RAM becomes full.

When you shut down your computer, the system’s RAM is wiped clean, but the page file is not. If you’re concerned about someone accessing sensitive data left in your page file, you can set up your Windows PC to erase it every time you shut down. However, if you don’t work with sensitive data, it’s not recommended to erase the page file at shutdown, as it can significantly increase your computer’s shutdown time, from a few seconds to several minutes, depending on your hard drive’s speed and the page file’s size. That’s why 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 the 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 the 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 on 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:-

gpedit.msc

Step 3. In the Local Group Policy Editor window that opens, browse 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!!!

Conclusion

In conclusion, optimizing your computer’s performance is crucial, and Windows offers various features to achieve this. One such feature is the Paging File, which acts as additional virtual memory when your RAM becomes full. While it is not recommended to erase the Paging File at shutdown for regular users, those working with sensitive data can use the methods explained in this post to ensure that the file is automatically cleared at shutdown. The two methods discussed are using the Registry Editor and Group Policy Editor. By following the steps mentioned above, you can easily erase the Windows Paging File at Shutdown in Windows 11/10/8/7 and enhance your computer’s security.

Leave a Reply