PowerShell 2+
To move the Windows page file to a new location, you can use WMI:
#requires -Version 2 $args = @{ Name = "D:\pagefile.sys" InitialSize = 0 MaximumSize = 1GB } Set-WmiInstance -Class Win32_PageFileSetting -Arguments $args
Changing the page file does require Administrator privileges, and you should know what you are doing, i.e. choose a suitable location and sizing.