If you have only one drive, or you want to maintain the integrity of the files on your secondary drive (i.e. so you could later boot into it if needed), you'll want to disable the pagefile first (steps to disable pagefile from link).
If you don't care about preserving the drive, skip to step 5.
- Press Win+R (or Win+S) → enter
SystemPropertiesPerformance.exe → press Enter → Click Advanced tab.
- Click Change under Virtual Memory and uncheck Automatically manage
paging file size for all drives.
- Click on the partition you are trying to resize and set paging file
size to No paging file. Click Set, then OK.
- Restart. You'll notice that both pagefile.sys and swapfile.sys are
now gone from your disk.
- If the page file is still there, use Unlocker to delete the page
file on restart.
I'm adding step 5 because the article seems to imply that the page file will disappear as soon as you restart.
This might not always be the case. When I restarted Windows 7 the file was still there. I couldn't delete the file because Windows 7 claimed the file was in use.
TAKEOWN didn't solve the problem either. Unlocker initially said that no locking handle was found.
However, Unlocker did give me an option to delete the file on restart, which worked great. @Kevin, Thanks for suggesting Unlocker.