Advertisement
Guest User

Untitled

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