Pagefile.sys acts as a virtual RAM, which Windows uses as RAM to store programs that are not in use, thus putting less pressure on the actual RAM. The page file size is usually near the size of your actual RAM, so it can take up a lot of space depending on your RAM. If you set the pagefile to delete with shutdown, you will save some hard drive space in exchange for slightly prolonging your shutdown time.
Here is one way you can get the system to automatically delete the pagefile.sys on shutdown in Windows 10.
To set this up, you’ll be making changes to the Windows registry. This should be safe, but to be super-safe, you should back up your Windows 10 registry before starting.
How Windows Clears the Pagefile
When you make Windows automatically clear the pagefile with every shutdown, it will actually overwrite the existing pagefile data with “zeros.” This makes it near impossible to recover data from the pagefile. However, because of the rewriting process, the time to shut down your system may increase.
Delete Pagefile using Registry Editor
1. Open the Windows 10 registry editor by pressing Win+ R, then entering
regedit in the box.
2. In the registry editor, go to:
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
3. Click “Memory Management,” and then double-click on “ClearPageFileAtShutDown” in the panel on the right.
4. Set its value to “1” and restart the PC. Every time you shut down your PC, the pagefile will be deleted. Don’t worry – it will be created again when needed.
Delete Pagefile using Windows Group Policy Editor
If you are using the Pro or Enterprise version of Windows, then you can use the Group Policy Editor to clear the pagefile automatically. To start, search for
gpedit.msc in the Start menu and open it.
The above action will open the Group Policy Editor. Here, navigate to “Computer Configuration -> Windows Settings -> Security Settings -> Local Policies -> Security Options” on the left panel.
On the right panel, find and double-click on the “Shutdown: Clear virtual memory page file” policy.
In the policy settings window, select the “Enabled” radio option, and then click on the “OK” button to save the changes.
Then just restart your system to make the changes take effect and you are good to go. If you ever want to revert back, simply select the “Disabled” radio option in the policy settings window.
If this tip has given you some confidence in the Windows registry, then you can find this and more in our list of Windows registry hacks. We also have a guide on how to edit another user’s registry in Windows 10.
Our latest tutorials delivered straight to your inbox