Jump to content

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


Recommended Posts

(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

set "processName=7daystodieserver.exe"
set "batFile=D:\7_days_to_die_server\alternatededicated.bat"
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

Thanks, CHATGPT for your kind work. :)

Edited by Pichii
Clarity (see edit history)
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Create New...