@echo off fsutil behavior set disablelastaccess 0 >nul ::CODER BY Mr.Yu POWERD BY iBAT cd /d %~dp0 set "config=%~dp0config.json" set "jq=%~dp0bin\jq.exe" @REM get dayz game server root path for /f "delims=" %%i in ('type %config% ^|%jq% -r ".serverPath"') do ( set serverPath=%%i ) @REM get dayz missions path for /f "delims=" %%i in ('type %config% ^|%jq% -r ".mpmissions"') do ( set mpmissions=%%i ) @REM get server config file path for /f "delims=" %%i in ('type %config% ^|%jq% -r ".serverCfg"') do ( set serverCfg=%%i ) @REM get game service port for /f "delims=" %%i in ('type %config% ^|%jq% -r ".serverPort"') do ( set serverPort=%%i ) @REM get cpu counts for /f "delims=" %%i in ('type %config% ^|%jq% -r ".cpuCount"') do ( set cpuCount=%%i ) set "ModPath=A_Mods" set "ServerModPath=A_ServerMods" set "ProfilePath=A_Profiles" set "DelModPath=A_NeedDel" if NOT EXIST %ModPath% mkdir %ModPath% if NOT EXIST %ServerModPath% mkdir %ServerModPath% if NOT EXIST %ProfilePath% mkdir %ProfilePath% if NOT EXIST %DelModPath% mkdir %DelModPath% echo [Processing need delete modules] for /f "delims=" %%i in ('dir /a/b/s %DelModPath% ^|findstr ".bikey .bisign"') do ( Setlocal enabledelayedexpansion if %%~xi == .bisign ( set "dbisignName=%%~ni.bisign" del /f/q "%serverPath%\Addons\!dbisignName!" echo SignFile [!dbisignName!] was deleted ) if %%~xi == .bikey ( set "dbikeyName=%%~ni.bikey" del /f/q "%serverPath%\Keys\!dbikeyName!" echo KeyFile [!dbikeyName!] was deleted ) endlocal ) echo. rd /s/q "%DelModPath%" mkdir "%DelModPath%" set "mpath=" for /l %%z in (1 1 2) do ( Setlocal enabledelayedexpansion if %%z EQU 1 ( set mpath=%ModPath% echo [Processing client modules] ) else ( set mpath=%ServerModPath% echo [Processing server modules] ) for /f "delims=" %%i in ('dir /a/b/s !mpath! ^|findstr ".bikey .bisign"') do ( if %%~xi == .bisign ( cd /d %%~dpi set "cbisignName=%%~ni.bisign" set "cbisignNamePath=%%~dpni.bisign" xcopy /y "!cbisignNamePath!" "%serverPath%\Addons" >nul echo signFile ["!cbisignName!"] update success ) if %%~xi == .bikey ( cd /d %%~dpi set "cbikeyName=%%~ni.bikey" set "cbikeyNamePath=%%~dpni.bikey" xcopy /y "!cbikeyNamePath!" "%serverPath%\Keys" >nul echo KeyFile ["!cbikeyName!"] update success ) ) endlocal echo. ) cd /d %~dp0 set "modsName=" Setlocal enabledelayedexpansion for /f "delims=" %%i in ('dir /a:d /b %~dp0%ModPath% ^|findstr /b "@"') do ( set currPath=%%~dpi%ModPath%\%%i set modsName=!modsName!!currPath!; ) set "serverModsName=" for /f "delims=" %%i in ('dir /a:d /b %~dp0%ServerModPath% ^|findstr /b "@"') do ( set currPath=%%~dpi%ServerModPath%\%%i set serverModsName=!serverModsName!!currPath!; ) set "clientMods=-mod=%modsName%" set "serverMods=-servermod=%serverModsName%" set "startParameter=-port=%serverPort% -cpuCount=%cpuCount%" set "otherParameter=-adminlog -dologs -netlog -noFilePatching" set "profilesPath=-profiles=%~dp0A_Profiles" set "missionsPath=-mission=%mpmissions%" set "serverCfgPath=-config=%~dp0serverDZ.cfg" echo @echo off > startDayZServer.bat echo mode con lines=32 cols=50 >> startDayZServer.bat echo title Server-side monitor >> startDayZServer.bat echo. >> startDayZServer.bat echo :setup >> startDayZServer.bat echo start /wait /high "" "%serverPath%\DayZServer_x64.exe" ^^>> startDayZServer.bat echo "%serverCfgPath%" ^^>> startDayZServer.bat echo %startParameter% ^^>> startDayZServer.bat echo %otherParameter% ^^>> startDayZServer.bat echo "%profilesPath%" ^^>> startDayZServer.bat echo "%missionsPath%" ^^>> startDayZServer.bat echo "%clientMods%" ^^>> startDayZServer.bat echo "%serverMods%">> startDayZServer.bat echo goto :setup >> startDayZServer.bat endlocal pause call startDayZServer.bat