Change Paging File to specified drive automaticall
#1
Posted 06 June 2004 - 02:21 AM
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
Posted 06 June 2004 - 05:06 AM
[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
Posted 06 June 2004 - 06:12 AM
Quote
::-------------
@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
Posted 06 June 2004 - 07:20 AM
Rico.JohnnY, on Jun 6 2004, 06:12 AM, said:
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
Posted 06 June 2004 - 07:36 AM
[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,00is 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
Posted 06 June 2004 - 07:43 AM
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.
#8
Posted 06 June 2004 - 08:29 AM
Quote
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
thanks 4 postin it
#9
Posted 06 June 2004 - 09:36 AM
prathapml: Thanks I'll check that out
Edit: prathapml, yours seems very effective
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
Posted 09 June 2004 - 05:03 AM
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
Posted 09 June 2004 - 03:46 PM
#12
Posted 09 June 2004 - 07:59 PM
Attached File(s)
-
error.JPG (22.92K)
Number of downloads: 4
#13
Posted 09 June 2004 - 09:42 PM
and this article... The Memory-Optimization Hoax
#14
Posted 10 June 2004 - 11:30 AM
By the way, interesting articles, especially the 2nd one
#15
Posted 11 June 2004 - 12:18 PM
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
Posted 11 June 2004 - 12:21 PM
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
Posted 11 June 2004 - 01:59 PM
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
#18
Posted 12 June 2004 - 06:54 AM
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
Posted 13 June 2004 - 02:15 AM
#20
Posted 13 June 2004 - 06:32 AM
Windows will expand a file that starts out too small and may shrink it again if it is larger than necessary,
- ← Is it possible to run .vbs scripts from cmdlines?
- Unattended Windows 2000/XP/2003
- Unattended activation needed →



Help


Back to top









