I created a quick batch file to check on valheim server and do backup of the save as it's not in the server folder, but i want to make it easier with variables.
would like to set a variable here
for %%a in (C:\Users\Administrator\AppData\LocalLow\IronGate\Valheim\worlds\Dedicated.db)
eg for %%a in (%%valserverdb\Dedicated.db)
How can this can be done?
@echo off
:loop
tasklist /FI "IMAGENAME eq valheim_server.exe" 2>NUL | find /I /N "valheim_server.exe">NUL
if "%ERRORLEVEL%"=="0" echo Valheim Server is running
if "%ERRORLEVEL%"=="1" echo Valheim Server is not running starting it. | E:\gameservers\valheim\start_headless_server.bat
SET valserverdb=C:\Users\Administrator\AppData\LocalLow\IronGate\Valheim\worlds
SET valbackup=E:\gameservers\backup\IronGate\Valheim\worlds
for %%a in (C:\Users\Administrator\AppData\LocalLow\IronGate\Valheim\worlds\Dedicated.db) do set valserverdbcheck=%%~ta
for %%b in (E:\gameservers\backup\IronGate\Valheim\worlds\Dedicated.db) do set valbackupcheck=%%~tb
if "%valserverdbcheck%" gtr "%valbackupcheck%" (xcopy "%valserverdb%" "%valbackup%" /S /E /Y) else (@echo File has not been changed. skipping)
timeout /t 300 /nobreak > NUL
goto loop