Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- ::This name doesn't actually matter, it's just to name the backup folder.
- set charToPreserve=INSERTNAMEHERE
- set done=0
- start cataclysm.exe
- :backup
- set Year=
- for /f "skip=2" %%x in ('wmic Path Win32_LocalTime get Year^,Month^,Day^,Hour^,Minute^,Second /Format:List') do (
- if not defined Year set %%x
- )
- if %Month% LSS 10 set Month=0%Month%
- if %Day% LSS 10 set Day=0%Day%
- if %Minute% LSS 10 set Minute=0%Minute%
- if %Hour% LSS 10 set Hour=0%Hour%
- set Timestamp=%Year%.%Month%.%Day% %Hour%%Minute%
- xcopy /s /i /y save "backups\%charToPreserve% %Timestamp%" >NUL
- if %done%==0 goto sleep
- exit
- :sleep
- set sleep=0
- :sleeploop
- ::Check if Cataclysm is running. If it is, loop. If not, we do a final backup and we're done.
- tasklist /FI "IMAGENAME eq cataclysm.exe" 2>NUL | find /I /N "cataclysm.exe">NUL
- if not "%ERRORLEVEL%"=="0" set done=1 & goto backup
- ::Ping nothing and output nothing for five seconds. Equivalent to "sleep" or "wait".
- ping -n 6 127.0.0.1 >NUL
- set /A sleep+=1
- ::Sleep 60 times (five minutes) then backup.
- if %sleep% lss 60 goto sleeploop
- goto backup
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement