How do I set the size of the pagefile from the command line?

8:58 AM

In order to set the pagefile size programically or from the command line you can use the builtin VBscript included with Windows located at:
C:\windows\system32\pagefileconfig.vbs
This will allow you to change the pagefile settings via script or from the command line manually. You can utilize the attached script on this page which is also listed below to modify your server's settings:

@echo off
 
REM  Syntax for the "pagefileconfig.vbs file is as follows:
REM  pagefileconfig.vbs /create [/s Computer [/u Domain\User [/p Password]]] {[/i InitialPageFileSize]|[/m MaximumPageFileSize]} /vo {VolumeLetter|*} [/vo {VolumeLetter2|*} [...]]
REM  pagefileconfig.vbs /change [/s Computer [/u Domain\User [/p Password]]] {[/i InitialPageFileSize]|[/m MaximumPageFileSize]} /vo {VolumeLetter|*} [/vo {VolumeLetter2|*} [...]]
REM  pagefileconfig.vbs /delete [/s Computer [/u Domain\User [/p Password]]] /vo {VolumeLetter|*} [/vo {VolumeLetter2|*} [...]]
REM  pagefileconfig.vbs /query  [/s Computer [/u Domain\User [/p Password]]] [/fo {TABLE|LIST|CSV}]
 
cls
echo Setting up Swap file on D: drive ...
echo (Press CTRL+C to cancel this operation if needed!!!)
echo.
cscript //nologo c:\windows\system32\pagefileconfig.vbs /change /i %1 /m %1 /vo d:
 
echo.
echo ========================================================
echo.
pause

NOTE
Icon
The script above creates a new swapfile based on what you pass it from the command line. The snytax for this script assuming that this is embedded in a batch script is as follows:
  • c:\configure_pagefile.cmd SIZE (where SIZE is the size of the pagefile you want in MB's)

You Might Also Like

0 comments

Contact Form

Name

Email *

Message *

Translate

Wikipedia

Search results