This how-to tutorial shows you how to tweak the Windows 10 Registry file to force the deletion of pagefile.sys every time you shut down your computer, thereby removing any potential security vulnerabilities. With this method, the next time you start your Windows 10 computer, the paging file will be recreated with new data.
Disclaimer: Editing the Windows Registry file is a serious undertaking. A corrupted Windows Registry file could render your computer inoperable, requiring a reinstallation of the Windows 10 operating system and potential loss of data. Back up the Windows 10 Registry file and create a valid restore point before you proceed.
How to delete the pagefile.sys file in Windows 10
To see what your current paging file settings are, follow these steps:
1. Open File Explorer and right-click Computer.
2. Select Properties.
3. Click on Advanced system settings (Figure A).
4. Click the Settings button under the Performance section and then click the Advanced tab. You should see a screen similar to Figure B. Your current settings for the Windows 10 paging file will be displayed under the Virtual Memory section. In the example, the paging file is currently set to be about 16 GB.
5. Click OK a couple of times to close those screens.
6. Start the Registry file tweaking process by typing “regedit” into the Cortana search box on the Windows 10 desktop.
7. Click the entry in the search results that refer to the Registry Editor program (regedit.exe).
8. With the app open, navigate to this specific key (Figure C):
Computer\HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management
9. In the right-hand window, double-click the ClearPageFileAtShutdown key and change the current default value from zero (“0”) to “1” (Figure D).
From this point on, until you change it back to zero (“0”), the paging file will be completely deleted on shutdown and then restarted fresh each time you start Windows 10