Advertisement
LaDEEKill3R

Add Recovery partition to boot menu

Nov 22nd, 2022
1,495
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.71 KB | Source Code | 0 0
  1. @ECHO OFF
  2. TITLE Add Recovery to Windows boot menu
  3. :SETLETTER
  4. CLS
  5. ECHO.
  6. ECHO             ###################################################
  7. ECHO             #                                                 #
  8. ECHO             #   This batch file creates recovery environment  #
  9. ECHO             #        adding it to Windows boot menu.          #
  10. ECHO             #                                                 #
  11. ECHO             ###################################################
  12. ECHO.....................................................................................................................
  13. ECHO.
  14. wmic logicaldisk get Name,VolumeName,size,freespace
  15. ECHO.....................................................................................................................
  16. SET /P DRIVELETTER= ^-- Please enter drive letter for your custom recovery partition (without colon):
  17. IF NOT EXIST %DRIVELETTER%:\sources\boot.wim ECHO. & ECHO No valid Windows image found on given partition %DRIVELETTER% &ECHO. & PAUSE & GOTO :SETLETTER
  18. ECHO.
  19. bcdedit /create {ramdiskoptions} /d "Ramdisk"
  20. bcdedit /set {ramdiskoptions} ramdisksdidevice partition=%DRIVELETTER%:
  21. bcdedit /set {ramdiskoptions} ramdisksdipath \boot\boot.sdi
  22. for /f "tokens=2 delims={}" %%i in ('bcdedit.exe /create /d "Recovery" /application OSLOADER') do (set guid={%%i})
  23. bcdedit /set %guid% device ramdisk=[%DRIVELETTER%:]\sources\boot.wim,{ramdiskoptions}
  24. bcdedit /set %guid% path \windows\system32\winload.efi
  25. bcdedit /set %guid% osdevice ramdisk=[%DRIVELETTER%:]\sources\boot.wim,{ramdiskoptions}
  26. bcdedit /set %guid% systemroot \windows
  27. bcdedit /set %guid% winpe yes
  28. bcdedit /set %guid% detecthal yes
  29. bcdedit /displayorder %guid% /addlast
  30. pause
Tags: Recovery
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement