Guest User

Untitled

a guest
Apr 6th, 2020
19
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. @echo off
  2. rem Starts a dedicated server
  3. rem
  4. rem -quit, -batchmode, -nographics: Unity commands
  5. rem -configfile : Allows server settings to be set up in an xml config file. Use no path if in same dir or full path.
  6. rem -dedicated : Has to be the last option to start the dedicated server.
  7.  
  8. set LOGTIMESTAMP=
  9.  
  10.  
  11. IF EXIST 7DaysToDieServer.exe (
  12. set GAMENAME=7DaysToDieServer
  13. set LOGNAME=output_log_dedi
  14. ) ELSE (
  15. set GAMENAME=7DaysToDie
  16. set LOGNAME=output_log
  17. )
  18.  
  19. :: --------------------------------------------
  20. :: REMOVE OLD LOGS (only keep latest 20)
  21.  
  22. for /f "tokens=* skip=19" %%F in ('dir %GAMENAME%_Data\%LOGNAME%*.txt /o-d /tc /b') do del %GAMENAME%_Data\%%F
  23.  
  24.  
  25.  
  26. :: --------------------------------------------
  27. :: BUILDING TIMESTAMP FOR LOGFILE
  28.  
  29. :: Check WMIC is available
  30. WMIC.EXE Alias /? >NUL 2>&1 || GOTO s_start
  31.  
  32. :: Use WMIC to retrieve date and time
  33. FOR /F "skip=1 tokens=1-6" %%G IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') DO (
  34. IF "%%~L"=="" goto s_done
  35. Set _yyyy=%%L
  36. Set _mm=00%%J
  37. Set _dd=00%%G
  38. Set _hour=00%%H
  39. Set _minute=00%%I
  40. Set _second=00%%K
  41. )
  42. :s_done
  43.  
  44. :: Pad digits with leading zeros
  45. Set _mm=%_mm:~-2%
  46. Set _dd=%_dd:~-2%
  47. Set _hour=%_hour:~-2%
  48. Set _minute=%_minute:~-2%
  49. Set _second=%_second:~-2%
  50.  
  51. Set LOGTIMESTAMP=__%_yyyy%-%_mm%-%_dd%__%_hour%-%_minute%-%_second%
  52.  
  53. :s_start
  54.  
  55.  
  56. :: --------------------------------------------
  57. :: STARTING SERVER
  58.  
  59.  
  60. echo|set /p="251570" > steam_appid.txt
  61. set SteamAppId=251570
  62. set SteamGameId=251570
  63.  
  64. set LOGFILE=%~dp0\%GAMENAME%_Data\%LOGNAME%%LOGTIMESTAMP%.txt
  65.  
  66.  
  67. echo Writing log file to: %LOGFILE%
  68.  
  69. start %GAMENAME% -logfile "%LOGFILE%" -quit -batchmode -nographics -configfile=serverconfig.xml -dedicated
  70.  
  71.  
  72. echo Starting server ...
  73. timeout 15
  74.  
  75. cls
  76.  
  77. echo.
  78. echo Server running in background, you can close this window.
  79. echo You can check the task manager if the server process is really running.
  80. echo.
  81. echo.
  82.  
  83. pause
Add Comment
Please, Sign In to add comment