Page 1 of 1

Allow more than 50% HDD shrink (W10)

Posted: 14 Nov 2018 07:06
by kyslakapusta
Hello guys,
I am trying to write script, which will allow me to shrink more then 50% of HDD. ( Windows 10 )

I know, that I have 3 problems:

1. disable hybernation
2. Disable system protection
3. disable Virtual memory

When all steps are done manualy everything is running without problems. I wrote following code, which is really runing and all parameters are changed, but shrink is not allowed.
Could you please check it?

Code: Select all

set /p type= Enable/Disable bigger shrink than 50%% (e/d)
if %type%== e GOTO :enable
if %type%== d GOTO :disable
goto :end

:enable
powercfg /h off
wmic pagefileset where name="C:\\pagefile.sys" delete
wmic computersystem set AutomaticManagedPagefile=False
wmic /namespace:\\root\default Path SystemRestore Call disable "C:\"
set /p index= Reboot required. Reboot? (y/n)
if %index%== y GOTO :restart
goto :end

:disable

powercfg /h on
wmic pagefileset create name="C:\\pagefile.sys"
wmic computersystem set AutomaticManagedPagefile=True
wmic /namespace:\\root\default Path SystemRestore Call enable "C:\"
set /p index= Reboot required. Reboot? (y/n)
if %index%== y GOTO :restart
goto :end

:restart
shutdown /f /r /t 5
:end
pause