Jump to content
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble
Strawberry Orange Banana Lime Leaf Slate Sky Blueberry Grape Watermelon Chocolate Marble

MSFN is made available via donations, subscriptions and advertising revenue. The use of ad-blocking software hurts the site. Please disable ad-blocking software or set an exception for MSFN. Alternatively, register and become a site sponsor/subscriber and ads will be disabled automatically. 


Sign in to follow this  
Rico.JohnnY

Change Paging File to specified drive automaticall

Recommended Posts

is there a way to change the paging file to another drive during an unattended installation of system?

for example...

i would like to change it to D:\ ,then resize the initial and maximum to 768 & 1536 respectively...

how to implement that?

Share this post


Link to post
Share on other sites

Hiya, if you take a look at

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]

You'll see a key "PagingFiles", which I think holds the information for the page file, export it and you should be done. However, I've tried it on a Virtual PC installation, but it's always locked at 191MB, it seems there's some problem with Page Files in a VPC, cause it's still stuck at 191MB even when I install without that specific registry setting. Anyway, mine's set to C:\pagefile.sys, with a fixed size of 768MB.

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]
"PagingFiles"=hex(7):43,00,3a,00,5c,00,70,00,61,00,67,00,65,00,66,00,69,00,6c,\
 00,65,00,2e,00,73,00,79,00,73,00,20,00,37,00,36,00,38,00,20,00,37,00,36,00,\
 38,00,00,00,00,00

Share this post


Link to post
Share on other sites
::Made by SibTiger  May 22, 2004

::-------------

@echo off

cls

echo.

echo * CHANGE PAGEFILE SIZE AND/OR LOCATION. *

:setdrive

SET dr=

Echo.

SET /P dr=Select drive letter for pagefile.

IF NOT '%dr%'=='' SET dr=%dr:~0,1%

echo This is a temporary file. Please delete. >%dr%:\~tmp.txt

if not exist %dr%:\~tmp.txt (

  echo.

  echo Drive %dr% doesn't exist! Enter a different drive letter.

  goto setdrive

)

del %dr%:\~tmp.txt

:setsize

echo ========================

echo.

echo    Set pagefile size...

SET Choice=

Echo.

echo  1 -  256MB pagefile

echo  2 -  384MB pagefile

echo  3 -  512MB pagefile

echo  4 -  768MB pagefile

echo  5 - 1024MB pagefile

echo  6 - 1536MB pagefile

SET /P Choice=    (1,2,3,4,5,6)

IF '%Choice%'=='1' (

set csize=256

goto editreg

)

IF '%Choice%'=='2' (

set csize=384

goto editreg

)

IF '%Choice%'=='3' (

set csize=512

goto editreg

)

IF '%Choice%'=='4' (

set csize=768

goto editreg

)

IF '%Choice%'=='5' (

set csize=1024

goto editreg

)

IF '%Choice%'=='6' (

set csize=1536

goto editreg

)

echo.

echo        !!!You must press 1,2,3,4,5 or 6. Try again.

goto setsize

:editreg

echo.

echo.

echo PAGEFILE WILL BE SET TO:  %dr%:\pagefile.sys SIZE: %csize%MB

echo Press any key to continue, or CTRL-C to abort

pause >NUL

:: ---- REGISTRY CHANGES FOR PAGEFILE SIZE AND LOCATION ----

echo Windows Registry Editor Version 5.00> cacheset.reg

echo.>> cacheset.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Memory Management]>> cacheset.reg

echo "PagingFiles"="%dr%:\\pagefile.sys %csize% %csize%">> cacheset.reg

echo.>> cacheset.reg

echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]>> cacheset.reg

echo "PagingFiles"="%dr%:\\pagefile.sys %csize% %csize%">> cacheset.reg

echo.>> cacheset.reg

:: ------ ADDS _CLEAN.CMD TO RUNONCE --------

echo [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce]>> cacheset.reg

echo "CLEANUP"="c:\\_clean.cmd">> cacheset.reg

echo.>> cacheset.reg

REGEDIT /S cacheset.reg

:: --- CREATE _CLEAN.CMD ---

::DELETES OLD PAGEFILE AFTER REBOOT

if exist c:\_clean.cmd del c:\_clean.cmd

echo @echo off> c:\_clean.cmd

echo rem Created automatically by cacheset.cmd on %date% at %time%.>> c:\_clean.cmd

echo echo Old pagefile being deleted. Please wait...>> c:\_clean.cmd

if /I not '%dr%'=='C' (

  echo if exist c:\pagefile.sys attrib -s -h c:\pagefile.sys>> c:\_clean.cmd

  echo if exist c:\pagefile.sys del /f /q c:\pagefile.sys>> c:\_clean.cmd

)

if /I not '%dr%'=='d' (

  echo if exist d:\pagefile.sys attrib -s -h d:\pagefile.sys>> c:\_clean.cmd

  echo if exist d:\pagefile.sys del /f /q d:\pagefile.sys>> c:\_clean.cmd

)

if /I not '%dr%'=='e' (

  echo if exist e:\pagefile.sys attrib -s -h e:\pagefile.sys>> c:\_clean.cmd

  echo if exist e:\pagefile.sys del /f /q e:\pagefile.sys>> c:\_clean.cmd

)

if /I not '%dr%'=='f' (

  echo if exist f:\pagefile.sys attrib -s -h f:\pagefile.sys>> c:\_clean.cmd

  echo if exist f:\pagefile.sys del /f /q f:\pagefile.sys>> c:\_clean.cmd

)

if /I not '%dr%'=='g' (

  echo if exist g:\pagefile.sys attrib -s -h g:\pagefile.sys>> c:\_clean.cmd

  echo if exist g:\pagefile.sys del /f /q g:\pagefile.sys>> c:\_clean.cmd

)

if /I not '%dr%'=='h' (

  echo if exist h:\pagefile.sys attrib -s -h h:\pagefile.sys>> c:\_clean.cmd

  echo if exist h:\pagefile.sys del /f /q h:\pagefile.sys>> c:\_clean.cmd

)

echo del c:\_clean.cmd>> c:\_clean.cmd

:: -------------------------

echo.

echo **** MUST REBOOT FOR SETTINGS TO TAKE EFFECT. ****

shutdown.exe -r -f -t 15 -c "Windows XP will now restart in 15 seconds..."

echo.

echo Automatic restart in 15 seconds. Press any key to abort.

pause >NUL

shutdown -a

goto end

:end

it's a bat file i find in the REG Tweak thread that someone posted.can anyone help to convert it to an auattended mode? for i know little about that..

i just want to move the Paging File to D:\ and resize it to 1536M.

Share this post


Link to post
Share on other sites
it's a bat file i find in the REG Tweak thread that someone posted.can anyone help to convert it to an auattended mode? for i know little about that..

i just want to move the Paging File to D:\ and resize it  to 1536M.

This should do it

::Made by SibTiger  May 22, 2004
::-------------
@echo off
cls
echo.
echo * CHANGE PAGEFILE SIZE AND/OR LOCATION. *
:setdrive
SET dr=D
Echo.
rem SET /P dr=Select drive letter for pagefile.
IF NOT '%dr%'=='' SET dr=%dr:~0,1%
echo This is a temporary file. Please delete. >%dr%:\~tmp.txt
if not exist %dr%:\~tmp.txt (
    echo.
    echo Drive %dr% doesn't exist! Enter a different drive letter.
    goto setdrive
)
del %dr%:\~tmp.txt
:setsize
echo ========================
echo.
echo    Set pagefile size...
SET Choice=6
Echo.
echo     1 -  256MB pagefile
echo     2 -  384MB pagefile
echo     3 -  512MB pagefile
echo     4 -  768MB pagefile
echo     5 - 1024MB pagefile
echo     6 - 1536MB pagefile
rem SET /P Choice=       (1,2,3,4,5,6)
IF '%Choice%'=='1' (
set csize=256
goto editreg
)
IF '%Choice%'=='2' (
set csize=384
goto editreg
)
IF '%Choice%'=='3' (
set csize=512
goto editreg
)
IF '%Choice%'=='4' (
set csize=768
goto editreg
)
IF '%Choice%'=='5' (
set csize=1024
goto editreg
)
IF '%Choice%'=='6' (
set csize=1536
goto editreg
)
echo.
echo           !!!You must press 1,2,3,4,5 or 6. Try again.
goto setsize
:editreg
echo.
echo.
echo PAGEFILE WILL BE SET TO:  %dr%:\pagefile.sys   SIZE: %csize%MB
echo Press any key to continue, or CTRL-C to abort
rem pause >NUL
:: ---- REGISTRY CHANGES FOR PAGEFILE SIZE AND LOCATION ----
echo Windows Registry Editor Version 5.00> cacheset.reg
echo.>> cacheset.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\ControlSet001\Control\Session Manager\Memory Management]>> cacheset.reg
echo "PagingFiles"="%dr%:\\pagefile.sys %csize% %csize%">> cacheset.reg
echo.>> cacheset.reg
echo [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]>> cacheset.reg
echo "PagingFiles"="%dr%:\\pagefile.sys %csize% %csize%">> cacheset.reg
echo.>> cacheset.reg
:: ------ ADDS _CLEAN.CMD TO RUNONCE --------
echo [HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\RunOnce]>> cacheset.reg
echo "CLEANUP"="c:\\_clean.cmd">> cacheset.reg
echo.>> cacheset.reg
REGEDIT /S cacheset.reg
:: --- CREATE _CLEAN.CMD ---
::DELETES OLD PAGEFILE AFTER REBOOT
if exist c:\_clean.cmd del c:\_clean.cmd
echo @echo off> c:\_clean.cmd
echo rem Created automatically by cacheset.cmd on %date% at %time%.>> c:\_clean.cmd
echo echo Old pagefile being deleted. Please wait...>> c:\_clean.cmd
if /I not '%dr%'=='C' (
    echo if exist c:\pagefile.sys attrib -s -h c:\pagefile.sys>> c:\_clean.cmd
    echo if exist c:\pagefile.sys del /f /q c:\pagefile.sys>> c:\_clean.cmd
)
if /I not '%dr%'=='d' (
    echo if exist d:\pagefile.sys attrib -s -h d:\pagefile.sys>> c:\_clean.cmd
    echo if exist d:\pagefile.sys del /f /q d:\pagefile.sys>> c:\_clean.cmd
)
if /I not '%dr%'=='e' (
    echo if exist e:\pagefile.sys attrib -s -h e:\pagefile.sys>> c:\_clean.cmd
    echo if exist e:\pagefile.sys del /f /q e:\pagefile.sys>> c:\_clean.cmd
)
if /I not '%dr%'=='f' (
    echo if exist f:\pagefile.sys attrib -s -h f:\pagefile.sys>> c:\_clean.cmd
    echo if exist f:\pagefile.sys del /f /q f:\pagefile.sys>> c:\_clean.cmd
)
if /I not '%dr%'=='g' (
    echo if exist g:\pagefile.sys attrib -s -h g:\pagefile.sys>> c:\_clean.cmd
    echo if exist g:\pagefile.sys del /f /q g:\pagefile.sys>> c:\_clean.cmd
)
if /I not '%dr%'=='h' (
    echo if exist h:\pagefile.sys attrib -s -h h:\pagefile.sys>> c:\_clean.cmd
    echo if exist h:\pagefile.sys del /f /q h:\pagefile.sys>> c:\_clean.cmd
)
echo del c:\_clean.cmd>> c:\_clean.cmd
:: -------------------------
echo.
echo **** MUST REBOOT FOR SETTINGS TO TAKE EFFECT. ****
shutdown.exe -r -f -t 15 -c "Windows XP will now restart in 15 seconds..."
echo.
echo Automatic restart in 15 seconds. Press any key to abort.
:: Remove the 2 lines below if you want the BAT to exit automatically, then windows restarts
pause >NUL
shutdown -a
goto end
:end

Share this post


Link to post
Share on other sites

as stated earlier -

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management]
"PagingFiles"=hex(7):53,00,3a,00,5c,00,70,00,61,00,67,00,65,00,66,00,69,00,6c,\
 00,65,00,2e,00,73,00,79,00,73,00,20,00,32,00,30,00,30,00,30,00,20,00,32,00,\
 30,00,30,00,30,00,00,00,00,00

is the setting, however it is in HEX.

when you look at it in the registry it looks like this:

S:\pagefile.sys 2000 2000 my pagefile is on the S drive and it is min 2000 and max 2000

So, set how you want it, export it out and then you can import it into your unattended without setting up a batch file!

Share this post


Link to post
Share on other sites

If you are going to use this on WinXP Pro, this is what you need to do:

1. go here : prathapml's tweaks

2. scroll down to tweak #17 (Pre-configure/automate your swap file)

3. Implement what is written there.

The method described in the site mentioned above is far simpler than any mentioned here, and is portable everywhere.

Share this post


Link to post
Share on other sites
If you are going to use this on WinXP Pro, this is what you need to do:

1. go here : prathapml's tweaks

2. scroll down to tweak #17 (Pre-configure/automate your swap file)

3. Implement what is written there.

nice job :) ill get some use outta that :rolleyes:

thanks 4 postin it :D

Share this post


Link to post
Share on other sites

WwTIPPYwW: Yep, that's what I did. However, the pagefile is always stuck at 191MB on my virtual PC. Does it work for you?

prathapml: Thanks I'll check that out :).

Edit: prathapml, yours seems very effective :rolleyes:. I'm trying it on my VPC in an hour or so :D.

Edit: Bah, it's still stuck at 191MB. The initial size shows 768MB, and the maximum size shows 768MB. However, the "Currently Allocated" shows 191MB. Restarting it didn't work. Is this a VPC 2004 bug?

Share this post


Link to post
Share on other sites

After setting your swap-file, you need to re-start. But since you say you have done that as well, I'd look for other reasons:

Does your Virtual machine have enough free Hard-disk space?

Did you install the VPC tools for the guest OS?

Is your VM hosted on a FAT32 partition on your host? (instead of NTFS as it should be)

If none of these reasons are true, then just dump VPC2004 - it just has too many bugs. VMware is 7x faster. As for the swap-space tweak I posted, it has worked invariably in all _real_ machines and in VMware - only VPC seems to have a problem (the problem you reported is the first time my tweak does not seem to work).

Share this post


Link to post
Share on other sites

Yup my virtual hard disk has 3GB, and it's NTFS :rolleyes:. Alright I'll give VMWare a try. Thanks man :).

Share this post


Link to post
Share on other sites

Hiya, I've tried VMWare. My page file is stuck at 383MB now =\. the attached screenshot will give a better idea of my problem. Thanks in advance. Notice the pagefile is set at 768-768MB, but the allocated is 383MB :). I've restarted many times already.

post-70-1086832766_thumb.jpg

Share this post


Link to post
Share on other sites

Hiya, thanks for those links, but they don't state any thing related to my problem, or did I miss it? :rolleyes:

By the way, interesting articles, especially the 2nd one :).

Share this post


Link to post
Share on other sites

Oh save me lord!

hey, ethux:

You need to reboot once after setting that swap-file command.

(Now I understand, it wasn't "stuck" as you say - it simply needed a restart).

YAY! So my tweak does work invariably after all.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

×