How to automatically clear the Pagefile.sys file when you shut down Windows

Xiaobai Software  2022-07-24 22: 31  read 44 views

When your Windows computer's RAM is full, it will transfer some data to the pagefile.sys file.This file acts as your computer's virtual RAM.Windows will clear RAM when you shut down your machine, but it will not empty pagefile.sys unless you tell it to do so.

The biggest reason you want to clear pagefile.sys is to clear any sensitive data it contains.Keep in mind that this may make the shutdown process slower if the file is large.

Here's how to get Windows to clear pagefile.sys on shutdown.


How to Clear on Shutdown Using Group Policy EditorPagefile.sys?

There is a Windows Group Policy that tells the OS to clear pagefile.sys on shutdown, you just need to enable it.To do this, follow these steps:

1. Press Win + S to open Windows Search and enter gpedit in the search box.

2. Click Edit Group Policy in the search results to launch the Local Group Policy Editor.


3. In the Group Policy Editor, go to Computer Configuration > Windows Settings > Security Settings > Local Policies > Security Options in the left panel.

4. In the right panel, double-click Close.Clear the virtual memory paging file policy.


5. In the Local Security Settings tab, click the Enable Radial button.


6. Click OK to save the changes and enable the policy.

How to Clear with Registry Editor at ShutdownPagefile.sys?

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

Here's how to use Registry Editor to tell Windows to clear pagefile.sys on shutdown:

1. Press Win + R to open the Run dialog.

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 following text in the address bar of the Registry Editor:


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

5. Double-click the ClearPageFileAtShutdown entry in the right panel to edit it.

6. Change the value data to 1.

7. Click OK to apply the change.

Now you know how to clear Pagefile.sys on shutdown?

With the above steps, Windows will delete pagefile.sys on every shutdown.All the sensitive data you feared it might contain will be gone, and when Windows restarts, it will start with a new pagefile.sys.

Address of this article:
Copyright Notice:The article only represents the author's point of view, the copyright belongs to the original author, welcome to share this article, please keep the source for reprinting!