Delete Pagefile.sys (Windows swap file) when Windows shuts down

The Windows swap file “pagefile.sys” should actually be known to most Windows users, because it expands the installed main memory (RAM) of the computer by additional, virtual main memory . All information that Windows tries to keep in main memory can be transferred to the Windows swap file if there is a lack of RAM .

Windows can therefore address more RAM than is actually installed in the computer. That sounds good in general, but of course has the disadvantage that this virtual RAM is relatively slow because it depends on the hard drive used (HDD or SSD). So every Windows user should try to use the swap file only rarely and to make sure that the main memory is free.

The Pagefile.sys file is saved in the root directory of the system partition , usually it is on ” C: “. The “Pagefile.sys” swap file is a hidden system file that is only visible when you have set the appropriate options in Windows Explorer .

Delete the swap file

But why should we do the delete Windows paging file when you shut down Windows . There are very good reasons for this, because the swap file can contain confidential information that was written to the file during the swap process . Especially if several people share a PC, the Windows swap file should be deleted when shutting down.

To delete the Pagefile.sys at shutdown you have to open the registry editor (regedit.exe) and switch to the following registry key.

HKEY_LOCAL_MACHINE SYSTEM CurrentControlSet Control Session Manager Memory Management

Here there should be the following value.


If the ” ClearPageFileAtShutdown ” value does not exist, it must be created as a 32-bit DWORD . Below we have mapped the registry key including the value.


By default, this value is set to “0” , which means that Windows Pagefile.sys is NOT deleted when Windows shuts down. If you change the value to “1” as shown, the swap file will be completely deleted when you shutdown . After the change you have to restart your Windows for the changes to take effect.

Incidentally, there is also the option of deleting the Windows swap file pagefile.sys using the Windows security setting (secpol.msc). We explained in detail how this works in our article ” Delete Windows swap file by security policy on shutdown “.

If you are looking for other interesting registry adjustments, we recommend the following articles.

– Enlarge the thumbnails in the Windows taskbar

Show the loudspeaker icon in the Windows 10 taskbar – Deactivate the autoplay in Windows 10 – Switch
off the greeting animation in Windows 10 by changing
the registry
– Delete the Windows user profile in the registry – Trash in Windows 10 Show Explorer
– Activate Remote Desktop using the registry key
– Remove the “Uninstall” function from the Windows 10 start menu