SHARE
TWEET

backupper_savekey

a guest Apr 2nd, 2018 62 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2.  
  3. reg query "HKU\S-1-5-19" >nul 2>&1 || (
  4.   echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
  5.   echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"
  6.   "%temp%\getadmin.vbs"
  7.   del "%temp%\getadmin.vbs" >nul 2>&1
  8.   exit /b
  9. )
  10.  
  11. set regkeyX64=HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion
  12. set regkeyX86=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion
  13. set regpathX64="%windir%\SysWOW64\winsevr.dat"
  14. set regpathX86="%windir%\System32\winsevr.dat"
  15. set regpath2X64="%%PROGRAMFILES(x86)%%\AOMEI Backupper\AmCore.dll"
  16. set regpath2X86="%%PROGRAMFILES%%\AOMEI Backupper\AmCore.dll"
  17.  
  18. if "%PROCESSOR_ARCHITECTURE%" equ "AMD64" (
  19.   set regkey=%regkeyX64%
  20.   set regpath=%regpathX64%
  21. ) else (
  22.   set regkey=%regkeyX86%
  23.   set regpath=%regpathX86%
  24. )
  25.  
  26. set regvalue=ProgramData
  27. set regfile=backupper_regfile.bin
  28. set restore=backupper_restore.bat
  29.  
  30. reg query %regkey% /v %regvalue% | findstr /i "%regvalue%" >"%temp%\tmpreg.reg"
  31. set /p tmp=<"%temp%\tmpreg.reg"
  32. del "%temp%\tmpreg.reg" >nul 2>&1
  33. set reghex=%tmp:~33%
  34.  
  35. copy %regpath% "%~dp0%regfile%" /y >nul 2>&1
  36.  
  37. echo @echo off>"%~dp0%restore%"
  38. echo.>>"%~dp0%restore%"
  39. echo reg query "HKU\S-1-5-19" ^>nul 2^>^&1 ^|^| ( >>"%~dp0%restore%"
  40. echo   echo Set UAC = CreateObject^^("Shell.Application"^^) ^> "%%temp%%\getadmin.vbs" >>"%~dp0%restore%"
  41. echo   echo UAC.ShellExecute "%%~s0", "", "", "runas", 1 ^>^> "%%temp%%\getadmin.vbs" >>"%~dp0%restore%"
  42. echo   "%%temp%%\getadmin.vbs" >>"%~dp0%restore%"
  43. echo   del "%%temp%%\getadmin.vbs" ^>nul 2^>^&1 >>"%~dp0%restore%"
  44. echo   exit /b >>"%~dp0%restore%"
  45. echo ) >>"%~dp0%restore%"
  46. echo. >>"%~dp0%restore%"
  47. echo set regkeyX64=%regkeyX64%>>"%~dp0%restore%"
  48. echo set regkeyX86=%regkeyX86%>>"%~dp0%restore%"
  49. echo set regpathX64=%regpathX64%>>"%~dp0%restore%"
  50. echo set regpathX86=%regpathX86%>>"%~dp0%restore%"
  51. echo set regpath2X64=%regpath2X64%>>"%~dp0%restore%"
  52. echo set regpath2X86=%regpath2X86%>>"%~dp0%restore%"
  53. echo. >>"%~dp0%restore%"
  54. echo if "%%PROCESSOR_ARCHITECTURE%%" equ "AMD64" ( >>"%~dp0%restore%"
  55. echo   set regkey=%%regkeyX64%%>>"%~dp0%restore%"
  56. echo   set regpath=%%regpathX64%%>>"%~dp0%restore%"
  57. echo   set regpath2=%%regpath2X64%%>>"%~dp0%restore%"
  58. echo ) else ( >>"%~dp0%restore%"
  59. echo   set regkey=%%regkeyX86%%>>"%~dp0%restore%"
  60. echo   set regpath=%%regpathX86%%>>"%~dp0%restore%"
  61. echo   set regpath2=%%regpath2X86%%>>"%~dp0%restore%"
  62. echo ) >>"%~dp0%restore%"
  63. echo. >>"%~dp0%restore%"
  64. echo reg add %%regkey%% /v %regvalue% /f /t REG_BINARY /d %reghex%>>"%~dp0%restore%"
  65. echo copy "%%~dp0%regfile%" %%regpath%% /y ^>nul 2^>^&1 >>"%~dp0%restore%"
  66. echo copy "%%~dp0%regfile%" %%regpath2%% /y ^>nul 2^>^&1 >>"%~dp0%restore%"
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
Not a member of Pastebin yet?
Sign Up, it unlocks many cool features!
 
Top