Need a unique gift idea?
A Pastebin account makes a great Christmas gift
SHARE
TWEET

VHD_set_over.bat

a guest Sep 7th, 2016 170 Never
Upgrade to PRO!
ENDING IN00days00hours00mins00secs
 
  1. echo VHD Diff Resetter created by Wolfgang Unger and modified by ZiroKyl http://9b.asoiu.com/?p=2793
  2.  
  3. REM #########################
  4. REM Variables
  5. REM #########################
  6. set VHD_Drive=D:
  7. set VHD_Parent=VHD\PROJECTOR_PC.VHD
  8. set VHD_OverFile1=VHD\PROJECTOR_PC_over1.VHD
  9. set VHD_OverFile2=VHD\PROJECTOR_PC_over2.VHD
  10. set VHD_OverGUID1={e3ccf964-9152-11e2-ad48-829adb767c32}
  11. set VHD_OverGUID2={e3ccf965-9152-11e2-ad48-829adb767c32}
  12.  
  13. set TempFile=D:\VHD\diskpart.log
  14. set LogFile=D:\VHD\diskpart_log.log
  15. REM #########################
  16.  
  17. setlocal enableextensions enabledelayedexpansion
  18.  
  19. SET _RUN=1
  20.  
  21. for /f "tokens=2* usebackq" %%i in (`bcdedit /enum {current} /v`) do (
  22.     if "%%i" == "{e3ccf963-9152-11e2-ad48-829adb767c32}" SET _RUN=0
  23. )
  24.  
  25. if %_RUN%==1 (
  26.  
  27. REM Try to delete both over file.
  28. del %VHD_Drive%\%VHD_OverFile1%
  29. del %VHD_Drive%\%VHD_OverFile2%
  30.  
  31. REM Cheack: if successful image 1 is bootet.
  32. if exist "%VHD_Drive%\%VHD_OverFile1%" (
  33.  
  34.  echo create vdisk file=%VHD_Drive%\%VHD_OverFile2% parent=%VHD_Drive%\%VHD_Parent% > %TempFile%
  35.  echo exit >> %TempFile%
  36.  
  37. REM Error code: https://technet.microsoft.com/en-us/library/cc766465(v=ws.10).aspx
  38.  diskpart /s %TempFile% >> %LogFile% && ( timeout /t 15 && bcdedit /default %VHD_OverGUID2% )
  39.  
  40. ) else (
  41.  
  42.  echo create vdisk file=%VHD_Drive%\%VHD_OverFile1% parent=%VHD_Drive%\%VHD_Parent% > %TempFile%
  43.  echo exit >> %TempFile%
  44.  
  45. REM Error code: https://technet.microsoft.com/en-us/library/cc766465(v=ws.10).aspx
  46.  diskpart /s %TempFile% >> %LogFile% && ( timeout /t 15 && bcdedit /default %VHD_OverGUID1% )
  47.  
  48. )
  49.  
  50. del %TempFile%
  51. echo Done.
  52. ) else (
  53. echo No needed.
  54. )
  55.  
  56. endlocal
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top