MSFN Forum: Change Paging File to specified drive automaticall - MSFN Forum

Jump to content



  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

Change Paging File to specified drive automaticall Rate Topic: -----

#1 User is offline   Rico.JohnnY 

  • Member
  • PipPip
  • Group: Members
  • Posts: 242
  • Joined: 02-June 04
  • OS:Windows 7 x64
  • Country: Country Flag

  Posted 06 June 2004 - 02:21 AM

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?


#2 User is offline   ethux 

  • Newbie
  • Group: Members
  • Posts: 20
  • Joined: 01-June 04

Posted 06 June 2004 - 05:06 AM

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


#3 User is offline   Rico.JohnnY 

  • Member
  • PipPip
  • Group: Members
  • Posts: 242
  • Joined: 02-June 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 06 June 2004 - 06:12 AM

Quote

::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.

#4 User is offline   FuzzBall 

  • Newbie
  • Group: Members
  • Posts: 36
  • Joined: 01-June 04

Posted 06 June 2004 - 07:20 AM

Rico.JohnnY, on Jun 6 2004, 06:12 AM, said:

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


#5 User is offline   WwTIPPYwW 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 330
  • Joined: 15-February 04

Posted 06 June 2004 - 07:36 AM

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!

#6 User is offline   prathapml 

  • Follow the rules please :-)
  • Group: Patrons
  • Posts: 6,791
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 06 June 2004 - 07:43 AM

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.

#7 User is offline   Rico.JohnnY 

  • Member
  • PipPip
  • Group: Members
  • Posts: 242
  • Joined: 02-June 04
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 06 June 2004 - 07:53 AM

Thx all you guys...you are so helpful

#8 User is offline   MCT 

  • MSFN Junkie
  • PipPipPipPipPipPipPipPipPip
  • Group: Members
  • Posts: 3,288
  • Joined: 19-May 04

Posted 06 June 2004 - 08:29 AM

Quote

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

#9 User is offline   ethux 

  • Newbie
  • Group: Members
  • Posts: 20
  • Joined: 01-June 04

Posted 06 June 2004 - 09:36 AM

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?

#10 User is offline   prathapml 

  • Follow the rules please :-)
  • Group: Patrons
  • Posts: 6,791
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 09 June 2004 - 05:03 AM

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).

#11 User is offline   ethux 

  • Newbie
  • Group: Members
  • Posts: 20
  • Joined: 01-June 04

Posted 09 June 2004 - 03:46 PM

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

#12 User is offline   ethux 

  • Newbie
  • Group: Members
  • Posts: 20
  • Joined: 01-June 04

Posted 09 June 2004 - 07:59 PM

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.

Attached File(s)

  • Attached File  error.JPG (22.92K)
    Number of downloads: 4


#13 User is offline   zippy 

  • Newbie
  • Group: Banned
  • Posts: 49
  • Joined: 18-May 04

Posted 09 June 2004 - 09:42 PM

check this article out...Virtual Memory in Windows XP
and this article... The Memory-Optimization Hoax

#14 User is offline   ethux 

  • Newbie
  • Group: Members
  • Posts: 20
  • Joined: 01-June 04

Posted 10 June 2004 - 11:30 AM

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 :).

#15 User is offline   prathapml 

  • Follow the rules please :-)
  • Group: Patrons
  • Posts: 6,791
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 11 June 2004 - 12:18 PM

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.

#16 User is offline   prathapml 

  • Follow the rules please :-)
  • Group: Patrons
  • Posts: 6,791
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 11 June 2004 - 12:21 PM

@ethux-
One more thing to note:
Don't be impatient to see the results of the swap file command.

1. Run the command.
2. Reboot
3. Check only now to see if it has been effective.

#17 User is offline   ethux 

  • Newbie
  • Group: Members
  • Posts: 20
  • Joined: 01-June 04

Posted 11 June 2004 - 01:59 PM

I've rebooted already? =\ I thought I stated it. Thanks though :rolleyes:.

Edit: I'm running it on VMware, and I've rebooted the virtual machine a lot of times already. Must I reboot my actual system? It doesn't make sense to me :). I can't test it out now, downloading some anime :D.

#18 User is offline   prathapml 

  • Follow the rules please :-)
  • Group: Patrons
  • Posts: 6,791
  • Joined: 14-November 03
  • OS:Windows 7 x64
  • Country: Country Flag

Posted 12 June 2004 - 06:54 AM

No, no need to reboot your host machine - just rebooting the VM is enough.
Check if your VM (within VPC or vmware) is cleanly shutting down - probably it is not, due to which the swap problem is appearing.

But please tell one thing - is the tweak working fine on a *REAL* machine for you?

#19 User is offline   ethux 

  • Newbie
  • Group: Members
  • Posts: 20
  • Joined: 01-June 04

Posted 13 June 2004 - 02:15 AM

I've yet to try that, but it should :). I trust your tweak, I just don't understand why VMWare and VPC are like this :rolleyes:.

#20 User is offline   zippy 

  • Newbie
  • Group: Banned
  • Posts: 49
  • Joined: 18-May 04

Posted 13 June 2004 - 06:32 AM

if you read the article Virtual Memory in Windows XP, take a close look at How big should the page file be? section.
Windows will expand a file that starts out too small and may shrink it again if it is larger than necessary,

Share this topic:


  • 2 Pages +
  • 1
  • 2
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users



All trademarks mentioned on this page are the property of their respective owners
Copyright © 2001 - 2011 msfn.org
Privacy Policy