After an unfortunate incident involving a crash and a lost save file, I decided to write a batch script to automatically back up my Subnautica 2 saves every x number of minutes. You’ll need 7-Zip and PowerShell installed.
This script will check if Subnautica 2 is running, and if so, will zip the Subnautica save folder to whatever folder the script is located.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | @echo off :loop rem Get HH:MM:SS for log prefix FOR /F "tokens=* USEBACKQ" %%F IN (`powershell get-date -format ^"{HH:mm:ss}^"`) DO ( SET logtime=%%F ) rem Determine if subnautica is running tasklist /fi "ImageName eq SubnauticaZero.exe" /fo csv 2>NUL | find /I "SubnauticaZero.exe">NUL rem If subnautica is running... if "%ERRORLEVEL%"=="0" ( rem Get current datetime https://stackoverflow.com/a/2854857 FOR /F "tokens=* USEBACKQ" %%F IN (`powershell get-date -format ^"{yyyy_MM_dd_HH_mm_ss}^"`) DO ( SET mydatetime=%%F ) rem Set up a folder name for our new backup SET stamp=slot0000-%mydatetime%.zip rem Back up with 7zip "C:\Program Files\7-Zip\7z.exe" a -tzip "%stamp%" "%USERPROFILE%\AppData\LocalLow\Unknown Worlds\Subnautica Below Zero\SubnauticaZero\SavedGames\slot0000" > NUL echo [%logtime%] Backed up to %stamp% ) else ( echo [%logtime%] Not running... ) rem sleep for 30 minutes https://stackoverflow.com/a/16803409 powershell -command "Start-Sleep -s 1800" goto loop |
To run the script simply save the above code into a file with a filename like backup.bat and double click it. Run it whenever you’re playing and close it when you’re done.