Advertisement
Guest User

Corsair Utility Engine backup script (save as .bat)

a guest
May 9th, 2017
309
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.82 KB | None | 0 0
  1. :: SBE
  2. :: Copy all text into a file, and "Save As" SBE.bat
  3. :: The name isn't important, but it MUST end with ".bat". If you're using Notepad, select "All Files" under "File Type" on the Save As window.
  4.  
  5. title Sam's Backup Engine for CUE (v0.2)
  6. color f0
  7. echo off
  8.  
  9. set BACKUPDIR=%USERPROFILE%\Documents\Corsair\CUE\Backup
  10. set CORSAIRDIR=%APPDATA%\Corsair\CUE
  11.  
  12. :: Check system architecture and set the CUE.exe file location accordingly
  13. if %PROCESSOR_ARCHITECTURE%==x86 (
  14.  :: 32 bit
  15.   set CORSAIRPROGRAMFILE="C:\Program Files\Corsair\Corsair Utility Engine\CUE.exe"
  16. ) else (
  17.  :: 64 bit
  18.   set CORSAIRPROGRAMFILE="C:\Program Files (x86)\Corsair\Corsair Utility Engine\CUE.exe"
  19. )
  20.  
  21. :: Avoid starting CUE in case we want to restore
  22. goto menu
  23.  
  24. :: Block to start CUE [not working as it should, todo: fix]
  25. :startcue
  26. cls
  27. echo Starting CUE...
  28. call %CORSAIRPROGRAMFILE%
  29. goto menu
  30.  
  31. :: Main menu block
  32. :menu
  33. cls
  34. echo Choose an option...
  35. echo.
  36. echo [1] Backup your settings
  37. echo [2] Restore your settings
  38. ::echo [3] Start CUE
  39.  
  40. set /p n=
  41. if %n% == 1 goto backupprompt
  42. if %n% == 2 goto restoreprompt
  43. ::if %n% == 3 goto startcue
  44. goto menu
  45.  
  46. :: Backup prompt block
  47. :backupprompt
  48. cls
  49. echo Are you sure? This will wipe your current backup and replace it with a new one.
  50. echo     Make sure your profiles are working before continuing!
  51. echo [1] Continue
  52. echo [2] Cancel and go to menu
  53.  
  54. set /p ahs=
  55. if %ahs% == 1 goto backup
  56. if %ahs% == 2 goto menu
  57. goto backupprompt
  58.  
  59. :: Backup block - holds the actual code to copy files
  60. :backup
  61. cls
  62. if NOT EXIST %BACKUPDIR% mkdir %BACKUPDIR% && echo Created backup folder.
  63. timeout /t 2 /nobreak >nul
  64. cls
  65. echo Deleting old backup...
  66. del /Q %BACKUPDIR%
  67. if errorlevel 1 goto fail
  68. if errorlevel 0 echo Success
  69. echo Copying new settings...
  70. xcopy /S /Y %CORSAIRDIR% %BACKUPDIR%
  71. if errorlevel 1 goto fail
  72. if errorlevel 0 echo Success
  73. echo.
  74. echo --------
  75. echo.
  76. echo All done! Return to menu by pressing any key.
  77. pause >nul
  78. goto menu
  79.  
  80. :restoreprompt
  81. cls
  82. echo Are you sure? This will wipe your profiles and replace them with the backed-up settings.
  83. echo !!    WARNING: Make sure CUE is properly closed before continuing    !!
  84. echo [1] Continue
  85. echo [2] Cancel and go to menu
  86.  
  87. set /p ays=
  88. if %ays% == 1 goto restore
  89. if %ays% == 2 goto menu
  90. goto restoreprompt
  91.  
  92. :restore
  93. cls
  94. echo Checking for backups...
  95. if NOT EXIST %BACKUPDIR% goto faildir
  96. echo Deleting old settings...
  97. del /Q %CORSAIRDIR%
  98. if errorlevel 1 goto fail
  99. if errorlevel 0 echo Success
  100. echo Copying new settings...
  101. xcopy /S /Y %BACKUPDIR% %CORSAIRDIR%
  102. if errorlevel 1 goto fail
  103. if errorlevel 0 echo Success
  104. echo.
  105. echo --------
  106. echo.
  107. echo All done! Return to menu by pressing any key.
  108. pause >nul
  109. goto menu
  110.  
  111. :fail
  112. echo.
  113. echo --------
  114. echo.
  115. echo SBE failed to run. See log above for more information.
  116. pause
  117. goto menu
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement