Home » How To » How to Clear or Delete PageFile.sys on Shutdown in Windows 11 & 10

How to Clear or Delete PageFile.sys on Shutdown in Windows 11 & 10

Learn how to configure Windows to automatically clear or delete PageFile.sys on shutdown in simple and easy steps.

By default, Windows uses PageFile.sys, a special file on your hard drive, as a virtual memory to extend the available memory for running applications. It also utilizes the PageFile.sys file to store infrequently accessed data. Unlike the data in RAM, which gets lost on power loss, the data in PageFile.sys persists on the disk. For performance reasons, Windows does not clear this file on shutdown or restart. That means data from your previous session may still remain on your disk. Generally, this is not a problem, and that is how it is intended to work.

However, there may be situations where you need to automatically clear the pagefile.sys file. For example, maybe you are working with sensitive files, have low storage, etc. Whatever your specific reason is, you can configure Windows to automatically delete the pagefile.sys file on shutdown or restart.

In this quick and straightforward guide, I will show you the steps to automatically delete PageFile.sys file on shutdown and restart. Let’s get started.

Before You Start

  • Administrator rights are required to automatically delete PageFile.sys on shutdown and restart.
  • The following process requires editing registry files. Before making changes, please back up the registry.
  • The following steps are tested to work on Windows 11 and Windows 10.

Automatically Delete PageFile.sys on Shutdown / Restart

  1. Press the “Windows key” to open the Start menu.
  2. Search for “Registry Editor” and click “Open“.
  3. Go to the following folder. HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
  4. Right-click the “Memory Management” folder on the sidebar.
  5. Select the “New” > “DWORD (32-bit) Value” option.
  6. Set “ClearPageFileAtShutdown” as the name of the new value.
  7. Double-click the value.
  8. Replace “0” with “1” and click “OK“.
  9. Close the Registry Editor and restart your computer.
  10. With that, Windows will automatically delete the PageFile.sys file on shutdown or restart.

Detailed Steps (With Screenshots)

First, we must open the Registry Editor. To do that, open the Start menu by clicking the “Windows” icon on the taskbar. Next, search for “Registry Editor” and click the “Open” option.

open registry editor in Windows 10

In the Registry Editor, go to the following folder using the sidebar. Alternatively, you can also paste the path in the Registry Editor’s address bar and press Enter.

HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management

Memory Management key in registry

Now, right-click on the “Memory Management” folder on the sidebar and select “New” and then “DWORD (32-bit) Value“.

The above action creates a new empty DWORD value. Name the value as “ClearPageFileAtShutdown“.

ClearPageFileAtShutdown value

Once the value has been created, double-click it to open the “Edit Value” window. In it, replace “0” with “1” in the “Value Data” field and click “OK“.

modify  ClearPageFileAtShutdown value

Finally, close the Registry Editor and restart your computer to make the change take effect. Once the system has been restarted, Windows will automatically clear or delete the PageFile.sys file on every shutdown or restart.

If you want to reverse it make make Windows no longer automatically delete the file, simply follow the same steps but replace “1” with “0” in the Value Data field.

If you have any questions or need help, comment below. I’ll be happy to assist.

Leave a Comment

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