Advertisement
IsaacSin

backup.bat (Elona)

Mar 2nd, 2013
5,449
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.95 KB | None | 0 0
  1. @echo off
  2. set done=0
  3.  
  4. start elona.exe
  5.  
  6. :backup
  7. set Year=
  8. for /f "skip=2" %%x in ('wmic Path Win32_LocalTime get Year^,Month^,Day^,Hour^,Minute^,Second /Format:List') do (
  9. if not defined Year set %%x
  10. )
  11. if %Month% LSS 10 set Month=0%Month%
  12. if %Day% LSS 10 set Day=0%Day%
  13. if %Minute% LSS 10 set Minute=0%Minute%
  14. if %Hour% LSS 10 set Hour=0%Hour%
  15. set Timestamp=%Year%.%Month%.%Day% %Hour%%Minute%
  16.  
  17. xcopy /s /i /y save "backups\%Timestamp%" >NUL
  18.  
  19. if %done%==0 goto sleep
  20. exit
  21.  
  22. :sleep
  23. set sleep=0
  24. :sleeploop
  25. ::Check if Elona is running. If it is, loop. If not, we do a final backup and we're done.
  26. tasklist /FI "IMAGENAME eq elona.exe" 2>NUL | find /I /N "elona.exe">NUL
  27. if not "%ERRORLEVEL%"=="0" set done=1 & goto backup
  28. ::Ping nothing and output nothing for five seconds. Equivalent to "sleep" or "wait".
  29. ping -n 6 127.0.0.1 >NUL
  30. set /A sleep+=1
  31. ::Sleep 360 times (thirty minutes) then backup.
  32. if %sleep% lss 360 goto sleeploop
  33. goto backup
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement