View difference between Paste ID: Yk3YP3Uy and ZT7wkFK3
SHOW: | | - or go back to the newest paste.
1
@echo off
2
3
::MAKE SURE ALL TASKS ARE REALLY STOPPED Panzer part
4
5
taskkill /f /fi "status eq not responding" /im 7DaysToDieServer.exe
6
taskkill /f /im 7DaysToDieServer.exe
7
timeout 3
8
9
10
11
12
13
14
15
16
17
18
19
rem Starts a dedicated server
20
rem
21
rem -quit, -batchmode, -nographics: Unity commands
22
rem -configfile			  : Allows server settings to be set up in an xml config file. Use no path if in same dir or full path.
23
rem -dedicated                    : Has to be the last option to start the dedicated server.
24
25
set LOGTIMESTAMP=
26
27
28
IF EXIST 7DaysToDieServer.exe (
29
	set GAMENAME=7DaysToDieServer
30
	set LOGNAME=output_log_dedi
31
) ELSE (
32
	set GAMENAME=7DaysToDie
33
	set LOGNAME=output_log
34
)
35
36
:: --------------------------------------------
37
:: REMOVE OLD LOGS (only keep latest 20)
38
39
for /f "tokens=* skip=19" %%F in ('dir %GAMENAME%_Data\%LOGNAME%*.txt /o-d /tc /b') do del %GAMENAME%_Data\%%F
40
41
42
43
:: --------------------------------------------
44
:: BUILDING TIMESTAMP FOR LOGFILE
45
46
:: Check WMIC is available
47
WMIC.EXE Alias /? >NUL 2>&1 || GOTO s_start
48
49
:: Use WMIC to retrieve date and time
50
FOR /F "skip=1 tokens=1-6" %%G IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') DO (
51
	IF "%%~L"=="" goto s_done
52
	Set _yyyy=%%L
53
	Set _mm=00%%J
54
	Set _dd=00%%G
55
	Set _hour=00%%H
56
	Set _minute=00%%I
57
	Set _second=00%%K
58
)
59
:s_done
60
61
:: Pad digits with leading zeros
62
Set _mm=%_mm:~-2%
63
Set _dd=%_dd:~-2%
64
Set _hour=%_hour:~-2%
65
Set _minute=%_minute:~-2%
66
Set _second=%_second:~-2%
67
68
Set LOGTIMESTAMP=__%_yyyy%-%_mm%-%_dd%__%_hour%-%_minute%-%_second%
69
70
:s_start
71
72
73
:: --------------------------------------------
74
:: STARTING SERVER
75
76
77
echo|set /p="251570" > steam_appid.txt
78
set SteamAppId=251570
79
set SteamGameId=251570
80
81
set LOGFILE=%~dp0\%GAMENAME%_Data\%LOGNAME%%LOGTIMESTAMP%.txt
82
83
84
echo Writing log file to: %LOGFILE%
85
86
start %GAMENAME% -logfile "%LOGFILE%" -quit -batchmode -nographics -configfile=serverconfig.xml -dedicated
87
88
89
echo Starting server ...
90
timeout 15
91
92
cls
93
94
echo.
95
echo Server running in background, you can close this window.
96
echo You can check the task manager if the server process is really running.
97
echo.
98
echo.
99
100
pause