Advertisement
Guest User

startdedicated.bat

a guest
Jan 23rd, 2019
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.78 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. :: --------------------------------------------
  12. :: REMOVE OLD LOGS (only keep latest 20)
  13.  
  14. for /f "tokens=* skip=19" %%F in ('dir 7DaysToDieServer_Data\output_log_dedi*.txt /o-d /tc /b') do del 7DaysToDieServer_Data\%%F
  15.  
  16.  
  17.  
  18. :: --------------------------------------------
  19. :: BUILDING TIMESTAMP FOR LOGFILE
  20.  
  21. :: Check WMIC is available
  22. WMIC.EXE Alias /? >NUL 2>&1 || GOTO s_start
  23.  
  24. :: Use WMIC to retrieve date and time
  25. FOR /F "skip=1 tokens=1-6" %%G IN ('WMIC Path Win32_LocalTime Get Day^,Hour^,Minute^,Month^,Second^,Year /Format:table') DO (
  26. IF "%%~L"=="" goto s_done
  27. Set _yyyy=%%L
  28. Set _mm=00%%J
  29. Set _dd=00%%G
  30. Set _hour=00%%H
  31. Set _minute=00%%I
  32. Set _second=00%%K
  33. )
  34. :s_done
  35.  
  36. :: Pad digits with leading zeros
  37. Set _mm=%_mm:~-2%
  38. Set _dd=%_dd:~-2%
  39. Set _hour=%_hour:~-2%
  40. Set _minute=%_minute:~-2%
  41. Set _second=%_second:~-2%
  42.  
  43. Set LOGTIMESTAMP=__%_yyyy%-%_mm%-%_dd%__%_hour%-%_minute%-%_second%
  44.  
  45. :s_start
  46.  
  47.  
  48. :: --------------------------------------------
  49. :: STARTING SERVER
  50.  
  51.  
  52. echo|set /p="251570" > steam_appid.txt
  53. set SteamAppId=251570
  54. set SteamGameId=251570
  55.  
  56. start 7daystodieserver -logfile 7DaysToDieServer_Data\output_log_dedi%LOGTIMESTAMP%.txt -quit -batchmode -nographics -configfile=serverconfig.xml -dedicated
  57.  
  58.  
  59. echo Starting server ...
  60. timeout 15
  61.  
  62. cls
  63.  
  64. echo.
  65. echo Server running in background, you can close this window.
  66. echo You can check the task manager if the server process is really running.
  67. echo.
  68. echo.
  69.  
  70. pause
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement