In order to defrag the page file, you’ll need to delete and recreate it. You can follow the steps below to accomplish this.
1.Click on the start icon in the bottom left corner and open the Control Panel.
2. Choose ‘System’ from the list in your control panel.
3. Click Advanced System Settings on the left hand side (See image below from Windows 7)
4. Make sure you are in the Advanced tab of the System Properties window now (See image below).
5. Choose settings in the performance section (See image below).
6. Choose the Advanced tab again in the Performance Options box.
7. In the Virtual memory section, choose the change button.
8. Uncheck the box next to “Automatically manage paging file size for all drives” (See image below)
9. Make sure your system drive is highlighted in the box (See image below).
10. Choose No paging file, click set, and click OK/Apply until you’ve exited out of every box (See image below)
11. Restart your computer.
That’s it, you’ve completed the how-to guide!