Advertisement
Guest User

PZ Auto Backup

a guest
Jan 12th, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 2.66 KB | None | 0 0
  1. @echo off
  2. set GameName=Project Zomboid
  3. ::Change this by opening "Run" and typing %userprofile% then press enter.
  4. ::Navigate to Zomboid/Saves/ pick multiplayer or a singleplayer mode and
  5. ::find a save that you want to keep regular backups of and copy the folder name
  6. ::and replace the "127.0.0.1_16261_SomeAccount" example.
  7.  
  8. :: Sandbox, Multiplayer, etc.
  9. set Folder="Multiplayer"
  10. set SaveName="127.0.0.1_16261_SomeAccount"
  11.  
  12. ::Default timeout is 300 (5 minutes).
  13. ::How often do you want backups to be made? (SECONDS)
  14. set Timeout=300
  15.  
  16. echo Starting %GameName%...
  17. ::If you wish to use 64bit comment out the 32 bit section and uncomment the 64bit section. Java.exe is intentional.
  18. ::--------------------------32Bit--------------------------
  19. set Game=ProjectZomboid32.exe
  20. start steam://run/108600
  21. ::--------------------------64Bit--------------------------
  22. ::set Game=java.exe
  23. ::set GameDirectory=D:\Steam\steamapps\common\ProjectZomboid
  24. ::start cmd /c %GameDirectory%\ProjectZomboid64.bat
  25. ::---------------------------------------------------------
  26.  
  27. ::---------------------------------------------------------------------------------------------------
  28. ::                          No need to edit anything beyond this point.                             ::
  29. ::---------------------------------------------------------------------------------------------------
  30. ::Checks for backup folder. If it doesn't exist, it'll make one.
  31. if not exist "%userprofile%\Zomboid\Saves\Backups\%SaveName%" mkdir "%userprofile%\Zomboid\Saves\Backups\%SaveName%"
  32.  
  33. ::Waits until the game is running, then continues.
  34. :Check
  35. cls
  36. echo Checking if %GameName% is running before making backups...
  37. Timeout 10 /NOBREAK
  38. tasklist /FI "IMAGENAME eq %Game%" 2>NUL | find /I /N "%Game%">NUL
  39. if "%ERRORLEVEL%"=="1" Goto Finish
  40. cls
  41. echo %GameName% is running.
  42. Goto Backup1
  43.  
  44. ::Checks if game is running and then makes a backup. If game isn't running, it will NOT make a backup.
  45. :Backup1
  46. tasklist /FI "IMAGENAME eq %Game%" 2>NUL | find /I /N "%Game%">NUL
  47. if "%ERRORLEVEL%"=="1" Goto Finish
  48. copy "%userprofile%\Zomboid\Saves\%Folder%\%SaveName%\map_p.bin" "%userprofile%\Zomboid\Saves\Backups\%SaveName%\map_p.bin.backup1"
  49. cls
  50. echo %GameName% is running.
  51. Timeout %Timeout% /NOBREAK
  52. Goto Backup2
  53.  
  54. :Backup2
  55. tasklist /FI "IMAGENAME eq %Game%" 2>NUL | find /I /N "%Game%">NUL
  56. if "%ERRORLEVEL%"=="1" Goto Finish
  57. copy "%userprofile%\Zomboid\Saves\%Folder%\%SaveName%\map_p.bin" "%userprofile%\Zomboid\Saves\Backups\%SaveName%\map_p.bin.backup2"
  58. cls
  59. echo %GameName% is running.
  60. Timeout %Timeout% /NOBREAK
  61. Goto Backup1
  62.  
  63. ::Stops script from making any more backups.
  64. :Finish
  65.  
  66. :: Made by STEAM_0:1:17013516
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement