I'm doing some memory benchmarking for research. Linux allows changing swap files at runtime with the swapon and swapoff commands.

Are there Windows commands to change page files without having to reboot the machine? I don't care about the data stored inside them, I just want to reduce the number of times I have to reboot and run another script.


You can control page file with the following commands from the command line:

wmic pagefile list /format:list

wmic pagefileset create name="P:\pagefile.sys"

wmic pagefileset where name="P:\pagefile.sys" set InitialSize=2048,MaximumSize=2048

wmic pagefileset where name="C:\pagefile.sys" delete

However, any modification to the pagefile requires a reboot to take effect.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.