Guest User

SteamBackup.cmd

a guest
Sep 19th, 2021
65
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. @echo off
  2.  
  3. :: ######### Configuration ###############
  4.  
  5. set STEAMDIR=C:\Program Files (x86)\Steam
  6. set SEVENZIPDIR=C:\Program Files\7-Zip
  7. set BACKUPDIR=SteamClientBackup\%date:~-4,4%.%date:~-7,2%.%date:~0,2%_%time:~0,2%.%time:~3,2%
  8. set BACKUPDIR=%BACKUPDIR: =0%
  9.  
  10. :: #######################################
  11.  
  12.  
  13.  
  14. echo Steam-Backup-Script
  15. echo -------------------
  16.  
  17. :: Check if Steam is running
  18. tasklist /FO LIST|find "steam.exe" >NUL
  19. if %ERRORLEVEL%==0 (
  20.     echo -Steam is currently running. Please close the application
  21.     echo. to let the backup script continue...
  22.     echo.
  23.     powershell -command "Wait-Process -Name 'steam'"
  24. )
  25.  
  26.  
  27. :: ### Steam Client Full ###
  28. ::
  29. :: Exclude: game-specific files in steamapps and userdata
  30. echo -Creating SteamClientFull.zip ...
  31. "%SEVENZIPDIR%\7z.exe" a "%BACKUPDIR%\SteamClientFull.zip" "%STEAMDIR%"^
  32.  -x!"Steam\steamapps\common"^
  33.  -x!"Steam\steamapps\*.acf"^
  34.  -x!"Steam\userdata\*\0*\"^
  35.  -x!"Steam\userdata\*\1*\"^
  36.  -x!"Steam\userdata\*\2*\"^
  37.  -x!"Steam\userdata\*\3*\"^
  38.  -x!"Steam\userdata\*\4*\"^
  39.  -x!"Steam\userdata\*\5*\"^
  40.  -x!"Steam\userdata\*\6*\"^
  41.  -x!"Steam\userdata\*\7?*\"^
  42.  -x!"Steam\userdata\*\8*\"^
  43.  -x!"Steam\userdata\*\9*\"^
  44.  -i!"%STEAMDIR%\steamapps\common\Steamworks Shared"^
  45.  -i!"%STEAMDIR%\steamapps\appmanifest_228980.acf" > backup.log 2>&1
  46.  
  47. "%SEVENZIPDIR%\7z.exe" rn "%BACKUPDIR%\SteamClientFull.zip"^
  48.  "Steamworks Shared" "Steam\steamapps\common\Steamworks Shared"^
  49.  "appmanifest_228980.acf" "Steam\steamapps\appmanifest_228980.acf" >> backup.log 2>&1
  50.  
  51.  
  52. :: ### Steam Client Light ###
  53. ::
  54. :: Exclude: game-specific files in steamapps and userdata
  55. :: +
  56. :: appcache\httpcache, Backups, depotcache, dumps, logs, steamapps\downloading,
  57. :: steamapps\shadercache, userdata\*\ugcmsgcache
  58. echo -Creating SteamClientLight.zip ...
  59. "%SEVENZIPDIR%\7z.exe" a "%BACKUPDIR%\SteamClientLight.zip" "%STEAMDIR%"^
  60.  -x!"Steam\steamapps\common"^
  61.  -x!"Steam\steamapps\*.acf"^
  62.  -x!"Steam\userdata\*\0*\"^
  63.  -x!"Steam\userdata\*\1*\"^
  64.  -x!"Steam\userdata\*\2*\"^
  65.  -x!"Steam\userdata\*\3*\"^
  66.  -x!"Steam\userdata\*\4*\"^
  67.  -x!"Steam\userdata\*\5*\"^
  68.  -x!"Steam\userdata\*\6*\"^
  69.  -x!"Steam\userdata\*\7?*\"^
  70.  -x!"Steam\userdata\*\8*\"^
  71.  -x!"Steam\userdata\*\9*\"^
  72.  -x!"Steam\steamapps\shadercache"^
  73.  -x!"Steam\steamapps\downloading"^
  74.  -x!"Steam\appcache\httpcache"^
  75.  -x!"Steam\Backups"^
  76.  -x!"Steam\depotcache"^
  77.  -x!"Steam\dumps"^
  78.  -x!"Steam\logs"^
  79.  -x!"Steam\userdata\*\ugcmsgcache"^
  80.  -i!"%STEAMDIR%\steamapps\common\Steamworks Shared"^
  81.  -i!"%STEAMDIR%\steamapps\appmanifest_228980.acf" >> backup.log 2>&1
  82.  
  83. "%SEVENZIPDIR%\7z.exe" rn "%BACKUPDIR%\SteamClientLight.zip"^
  84.  "Steamworks Shared" "Steam\steamapps\common\Steamworks Shared"^
  85.  "appmanifest_228980.acf" "Steam\steamapps\appmanifest_228980.acf" >> backup.log 2>&1
  86.  
  87.  
  88. :: ### Steam Registry keys ###
  89. echo -Backing up Steam Registry keys...
  90. reg export "HKCU\Software\Valve" "%BACKUPDIR%\steam_hkcu.reg" /y >> backup.log 2>&1
  91. reg export "HKLM\SOFTWARE\Wow6432Node\Valve" "%BACKUPDIR%\steam_hklm.reg" /y >> backup.log 2>&1
  92.  
  93. echo.
  94. echo Backup finished!
  95. timeout /t 4 >> backup.log 2>&1
  96.  
RAW Paste Data