Guest User

PAE Patch Script

a guest
Sep 3rd, 2015
220
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2. cd /d "%~dp0"
  3.  
  4. (set winver=0) & (set current=0) & (set winload=0) & (set patched=0)
  5.  
  6. bcdedit /enum >nul 2>&1
  7. if %errorlevel% neq 0 (echo -ERROR- Command BCDEDIT Missing!) & (goto end)
  8.  
  9. ver | find "6.1." >nul 2>&1
  10. if %errorlevel% equ 0 (set winver=7) & (set kernel=ntkrnlpa.exe)
  11. ver | find "6.2." >nul 2>&1
  12. if %errorlevel% equ 0 (set winver=8) & (set kernel=ntoskrnl.exe)
  13. ver | find "6.3." >nul 2>&1
  14. if %errorlevel% equ 0 (set winver=8.1) & (set kernel=ntoskrnl.exe)
  15. ver | find "10.0." >nul 2>&1
  16. if %errorlevel% equ 0 (set winver=10) & (set kernel=ntoskrnl.exe)
  17. if %winver% equ 0 (echo -ERROR- Unknown Windows Version!) & (goto end)
  18. if not exist "%systemroot%\system32\%kernel%" (echo -ERROR- Cannot Find %kernel%!) & (goto end)
  19.  
  20. FOR /F %%a in ('bcdedit /enum ^| find "{current}"') do set current=1
  21. if %current% equ 0 (echo -ERROR- Unknown Boot Config!) & (goto end)
  22.  
  23. FOR /F %%a in ('bcdedit /enum {current} ^| find "%systemroot:~2%\system32\winload.exe"') do set winload=1
  24. FOR /F %%a in ('bcdedit /enum {current} ^| find "%systemroot:~2%\system32\winloadx.exe"') do set winload=1
  25. if %winload% equ 0 (echo *ERROR- Cannot Detect Loader!) & (goto end)
  26.  
  27. echo ++ Executing Kernel Patch!
  28. Patchpae -type kernel -o "%systemroot%\system32\ntkrnlpx.exe" "%systemroot%\system32\%kernel%" >nul 2>&1
  29. if %errorlevel% neq 0 (echo -ERROR- Cannot Patch %kernel%!) & (goto end)
  30. echo ++ Executing Loader Patch!
  31. Patchpae -type loader -o "%systemroot%\system32\winloadx.exe" "%systemroot%\system32\winload.exe" >nul 2>&1
  32. if %errorlevel% neq 0 (echo -ERROR- Cannot Patch winload.exe!) & (goto end)
  33.  
  34. FOR /F %%a in ('bcdedit /enum ^| find "ntkrnlpx.exe"') do set patched=1
  35. if %patched% equ 1 (goto finished)
  36.  
  37. echo ++ Adding New Boot Entry!
  38. FOR /F "tokens=2 delims={}" %%g in ('bcdedit /copy {current} /d "Windows %winver% (PAE)"') do set newguid=%%g
  39. bcdedit /set {%newguid%} kernel "ntkrnlpx.exe" >nul 2>&1
  40. bcdedit /set {%newguid%} path "%systemroot:~2%\system32\winloadx.exe" >nul 2>&1
  41. bcdedit /set {%newguid%} nointegritychecks yes >nul 2>&1
  42. bcdedit /set {bootmgr} default {%newguid%} >nul 2>&1
  43. bcdedit /set {bootmgr} displaybootmenu yes >nul 2>&1
  44. bcdedit /set {bootmgr} timeout 3 >nul 2>&1
  45.  
  46. :finished
  47. echo ++ Success, All Done!
  48. :end
  49. ping 127.0.0.1 -n 10 >nul 2>&1
RAW Paste Data

Adblocker detected! Please consider disabling it...

We've detected AdBlock Plus or some other adblocking software preventing Pastebin.com from fully loading.

We don't have any obnoxious sound, or popup ads, we actively block these annoying types of ads!

Please add Pastebin.com to your ad blocker whitelist or disable your adblocking software.

×