Rather than try to do this manually, I'd recommend a command-line tool courtesy of the good folks at SysInternals, which is designed to do exactly that: PAGEDEFRAG. When run, it will force a defrag on your page file the next time your machine is rebooted. You can also use it to force a defrag of the page file on each reboot, which is handy.
Learn more: What is virtual memory? Read a definition from WhatIs.com.
This was first published in August 2005