Quickly changing Pagefile size?


Durahl

Well-known member
Member
Local time
4:09 PM
Posts
23
Location
Nearby, on an Astronomical Scale.
OS
Windows 11
Greetings!

I'm currently dabbling around with AI related Stuff and have seemingly hit an issue where I'm running out of System RAM and was told to increase the Pagefile size to solve it.
The stuff I do is probably going to be a once in a full moon thing ( creating Orthographical Views of a Character for AI 3D Model Generation for Scale Modelling ) so obviously I'd only want to increase the Pagefile whenever I need it and then revert it back which brings me to my question(s):
  • Does a Batchfile Command Exist to set the Pagefile to a user defined value ( and another to revert it back to System Controlled )
  • Does changing the Pagefile ( via said Batchfile ) require a full System Restart or does it take immediate effect? ( what about just logging out and back in? )
Thanks in advance! 😁
 

My Computers

System One System Two

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    DIY
    CPU
    Intel Core i9-13900KF
    Motherboard
    NZXT N7 Z790
    Memory
    Corsair Vengeance DDR5 5600 64GB
    Graphics Card(s)
    Nvidia GeForce RTX 4090 Founders Edition
    Monitor(s) Displays
    SONY KD-77A1 77" 4K HDR TV
    Screen Resolution
    3840 x 2160
    Hard Drives
    2x Samsung M.2 970 PRO 1TB
    2x Samsung SSD 870 EVO 2TB
    PSU
    Be Quiet! Dark Power 13 1'000W
    Case
    Corsair Obsidian Series 900D
    Cooling
    NZXT Kraken Elite 360
    Keyboard
    Logitech MX Mechanical Mini
    Mouse
    Logitech MX Master 3S
    Internet Speed
    1GBit
  • Operating System
    Windows 11
    Computer type
    Laptop
    Manufacturer/Model
    Surface Book /w Performance Base
    CPU
    6th Gen Core i7-6600U
    Memory
    16GB
    Graphics card(s)
    nVidia GeForce GTX 965M
    Screen Resolution
    3000 x 2000
    Hard Drives
    1TB
    Mouse
    Logitech MX Master 3 Wireless Mouse
    Internet Speed
    1GBit
I don't do batch files, but here's ten points for filling out your computer specs. :-)
 

My Computers

System One System Two

  • OS
    Win 11 Home ♦♦♦26200.8457 ♦♦♦♦♦♦♦25H2
    Computer type
    PC/Desktop
    Manufacturer/Model
    Built by Ghot® [May 2020]
    CPU
    AMD Ryzen 7 3700X
    Motherboard
    Asus Pro WS X570-ACE (BIOS 5302)
    Memory
    G.Skill (F4-3200C14D-16GTZKW)
    Graphics Card(s)
    EVGA RTX 2070 (08G-P4-2171-KR)
    Sound Card
    Realtek ALC1220P / ALC S1220A
    Monitor(s) Displays
    Dell U3011 30"
    Screen Resolution
    2560 x 1600
    Hard Drives
    2x Samsung 860 EVO 500GB,
    WD 4TB Black FZBX - SATA III,
    WD 8TB Black FZBX - SATA III,
    DRW-24B1ST CD/DVD Burner
    PSU
    PC Power & Cooling 750W Quad EPS12V
    Case
    Cooler Master ATCS 840 Tower
    Cooling
    CM Hyper 212 EVO (push/pull)
    Keyboard
    Ducky DK9008 Shine II Blue LED
    Mouse
    Logitech Optical M-100
    Internet Speed
    300/300
    Browser
    Firefox (latest)
    Antivirus
    Bitdefender Total Security
    Other Info
    Speakers: Klipsch Pro Media 2.1
  • Operating System
    Windows XP Pro 32bit w/SP3
    Computer type
    PC/Desktop
    Manufacturer/Model
    Built by Ghot® (not in use)
    CPU
    AMD Athlon 64 X2 5000+ (OC'd @ 3.2Ghz)
    Motherboard
    ASUS M2N32-SLI Deluxe Wireless Edition
    Memory
    TWIN2X2048-6400C4DHX (2 x 1GB, DDR2 800)
    Graphics card(s)
    EVGA 256-P2-N758-TR GeForce 8600GT SSC
    Sound Card
    Onboard
    Monitor(s) Displays
    ViewSonic G90FB Black 19" Professional (CRT)
    Screen Resolution
    up to 2048 x 1536
    Hard Drives
    WD 36GB 10,000rpm Raptor SATA
    Seagate 80GB 7200rpm SATA
    Lite-On LTR-52246S CD/RW
    Lite-On LH-18A1P CD/DVD Burner
    PSU
    PC Power & Cooling Silencer 750 Quad EPS12V
    Case
    Generic Beige case, 80mm fans
    Cooling
    ZALMAN 9500A 92mm CPU Cooler
    Keyboard
    Logitech Classic Keybooard 200
    Mouse
    Logitech Optical M-BT96a
    Internet Speed
    300/300
    Browser
    Firefox 3.x ??
    Antivirus
    Symantec (Norton)
    Other Info
    Still assembled, still runs. Haven't turned it on for 15 years?
Here it is in powershell. You have to do a restart.

Code:
$init = @{ Query = 'Select * From Win32_PageFileSetting Where Name like "%pagefile.sys"';Property = @{initialsize="900"} }
$max = @{ Query = 'Select * From Win32_PageFileSetting Where Name like "%pagefile.sys"';Property = @{maximumsize="2048"} }
set-ciminstance @init
set-ciminstance @max
 

My Computers

System One System Two

  • OS
    Windows 11 Pro x64
    Computer type
    PC/Desktop
    Manufacturer/Model
    📷🔈🎧 🪛 DIY Photoshop/Audio/Game/tinker
    CPU
    i9 14900K P/E 5.8/4.5 GHz, cache 5.0 GHz
    Motherboard
    Asus ROG Maximus Z790 Dark Hero
    Memory
    🐏 96GB (2x48) G.skill Ripjaws 6800 MT/s
    Graphics Card(s)
    Asus ROG Strix 4070 Ti OC
    Sound Card
    🔊Bowers & Wilkins 606 S3 speakers; Audiolabs 7000a integrated amp; RSL 10S Mk2 sub; Creative Pebble Pro Minimilist
    Monitor(s) Displays
    🖥️🖥️ Eizo CG2730 ColorEdge, ViewSonic VP2768
    Screen Resolution
    🖥️🖥️ 2560 x 1440p x 2
    Hard Drives
    💾 WDC SN850X 4TB nvme, SN850 1TB nvme, SK-Hynix 2 TB P41 nvme,. Sabrent USB-C DS-SC5B 5-bay docking station: 6TB WDC Black, 6TB Ironwolf Pro; 2x 2TB WDC Black HDD
    PSU
    ⚡️ 850W Seasonic Vertex PX-850 ATX 3.0/PCI-E 5.0
    Case
    Fractal Design North XL Mesh, Black Walnut
    Cooling
    ❄️ EK Nucleus black 360 AIO w/Phanteks T30-120 fans, 2 Noctua NF-A14 Chromax case fan, 1 T30-120 fan cooling memory
    Keyboard
    ⌨️ Keychron Q3 Max TKL with custom GMK Redsuns Red Samuri keycaps, TX Stabs
    Mouse
    🖱️ Logitech G305 wireless gaming
    Internet Speed
    ⬇️ 500 Mb/s ⬆️ 12 Mb/s
    Browser
    🔥🦊 Firefox
    Antivirus
    🦺 Defender, Macrium Reflect X 🏆
    Other Info
    Phangkey Amaterasu V2 Desk Mat
  • Computer type
    Laptop
    Manufacturer/Model
    💻 Apple 13" Macbook Pro 2020 (m1)
    CPU
    Apple M1
    Screen Resolution
    2560x1600
    Browser
    Firefox
Attached batch script changes pagefile to twice installed RAM size.

Batch:
@Echo Off & Cls

net sess>nul 2>&1||(powershell start cmd -ArgumentList """/c %~0""" -verb Runas & exit)

:: Set virtual memory size to static amount.
SETLOCAL ENABLEDELAYEDEXPANSION
For /f "tokens=4,5* delims=,. " %%G in ('Systeminfo  ^| Find "Total Physical Memory:"') DO Set RAM=%%G%%H
If "!RAM!"=="" Goto :EOF
set /a "pageSize=ram + ram / 2"
Reg add "HKLM\SYSTEM\CurrentControlSet\Control\SESSION MANAGER\MEMORY MANAGEMENT" /v "PagingFiles" /t REG_MULTI_SZ /d "c:\pagefile.sys !PageSize! !PageSize!"  /f
ENDLOCAL



Cls & Mode CON  LINES=11 COLS=51 & Color 0E & Title FreeBooter
Echo.
Echo.
Echo THIS COMPUTER WILL REBOOT
Echo.
Echo.
Echo PLEASE SAVE ALL WORK IN PROGRESS
Echo.
Echo.
Echo PRESS 'ENTER' KEY TO REBOOT PC

Pause >Nul

Shutdown  -r  -t 5  -c "REBOOTING SYSTEM"
 

Attachments

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
    Manufacturer/Model
    HP Pavilion
    CPU
    AMD Ryzen 7 5700G
    Motherboard
    Erica6
    Memory
    Micron Technology DDR4-3200 16GB
    Graphics Card(s)
    NVIDIA GeForce RTX 3060
    Sound Card
    Realtek ALC671
    Monitor(s) Displays
    Samsung SyncMaster U28E590
    Screen Resolution
    3840 x 2160
    Hard Drives
    SAMSUNG MZVLQ1T0HALB-000H1
A system managed pagefile should be all you need. This will allow the pagefile to be dynamically enlarged to meet the demand. When the need is no longer there the pagefile will be resized down, if possible. It won't always be possible. If there is data in the extended portion of the pagefile it will not be possible to shrink it.

In some situations it may be necessary to set a custom configuration. Manual changes to the pagefile should not be necessary.

Expanding the pagefile does not mean writing to the expanded portion so it will be fast.

The pagefile is very much misunderstood. There is a good deal of misinformation on the Internet regarding the pagefile, some of it from Microsoft. It is difficult to write documentation that is both technically accurate and easy to understand. Microsoft user level documentation tends toward the latter at the expense of technical accuracy. Technical documentation is accurate but will be heavy going unless you have the technical background.
 

My Computer

System One

  • OS
    Windows 11
    Computer type
    PC/Desktop
Back
Top Bottom