• If you have a mod, tool or prefab, please use the Resources section. Click Mods at the top of the forums.

7 Days to Die Server Auto-Restart Code via CMD (Works with any game tho)

Pichii

New member
(Note, REM is commented out; remove them if you want the script to automatically restart. Script goes in 7d2d directory, make a shortcut of the script into startup folder. Save script as .cmd You will need to change your bat file target that launches 7d2d normally.)
PS: Set your shortcut to "Run Minimized" to make the waiting CMDline run in background and not interfere with your work.

@echo off
setlocal

set "processName=7daystodieserver.exe"
set "batFile=D:\7_days_to_die_server\alternatededicated.bat"
:redo
tasklist | findstr /i "%processName%" > nul

if %errorlevel% neq 0 (
echo "7daystodie" process not found. Starting Server...
start "" "%batFile%"
timeout /t 5
) else (
echo "7daystodie" process found.
)
REM Causes_script_to_loop_on_itself,_forever_causing_auto-restart_to_occour,_if_needed._DONOT_Remove_REM_for_this_line
REM timeout /t 900 /nobreak
REM goto :redo
endlocal
Thanks, CHATGPT for your kind work. :)

 
Last edited by a moderator:
Back
Top