How to Automatically Clear the Pagefile.sys File When Shutting Down Windows

Windows doesn’t clear your Pagefile.sys file on shutdown, but you can ask it to do so if you’d like.

When your Windows computer’s RAM is full, it transfers some of its data to the pagefile.sys file. This file acts as your PC’s virtual RAM. When you shut down your machine, Windows will clear out the RAM, but it won’t empty pagefile.sys unless you tell it to.

The biggest reason you’d want pagefile.sys cleared is to get rid of any sensitive data it contains. Just keep in mind that this can make the shutdown process a little slower if the file is large.


Here’s how to get Windows to clear pagefile.sys when shutting down.

How to Clear Pagefile.sys at Shutdown With the Group Policy Editor

There’s a Windows Group Policy that tells the OS to clear pagefile.sys at shutdown, and you just need to enable it. To do that, follow the steps below:

  1. Press Win + S to open Windows Search and type gpedit in the search box.
  2. Click on Edit group policy in the search results to launch the Local Group Policy Editor.
  3. In the Group Policy Editor, head to Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options in the left panel.
  4. In the right panel, double-click the Shutdown: Clear virtual memory pagefile policy.
  5. In the Local Security Setting tab, click the Enabled radial button.
  6. Click OK to save the change and enable the policy.

How to Clear Pagefile.sys at Shutdown With the Registry Editor

Before you use the Registry Editor to make any changes to the Windows Registry, we recommend creating a system restore point. This will be your contingency plan in case something goes wrong.

With that out of the way, here’s how to use the Registry editor to tell Windows to clear pagefile.sys at shutdown:

  1. Press Win + R to open the Run dialog box.
  2. Type regedit and click OK to open the Registry Editor.
  3. Click Yes to bypass the UAC prompt.
  4. In the left panel of the Registry Editor, navigate to HKEY_LOCAL_MACHINE > SYSTEM > CurrentControlSet > Control > Session Manager > Memory Management. Alternatively, you can copy and paste the below text in the Registry Editor’s address bar:
    HKEY_LOCAL_MACHINESYSTEMCurrentControlSetControlSession ManagerMemory Management
  5. Double-click the ClearPageFileAtShutdown entry in the right panel to edit it.
  6. Change Value data to 1.
  7. Click OK to apply the change.

Now You Know How to Clear Pagefile.sys at Shutdown

With the steps above, Windows will delete pagefile.sys every time it’s shutting down. All the sensitive data you’re worried it might contain will be gone, and Windows will start with a fresh pagefile.sys when it boots back up.

If you don’t want Windows to use pagefile.sys, and you have enough RAM installed on your computer that it won’t run out, you can disable paging altogether.

Source link

Leave a Reply

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

Call Us