Advertisement
sneaky4oe

PATCH-FIRST-RUN-ADMIN.bat

Jun 20th, 2018
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Batch 1.89 KB | None | 0 0
  1. @echo off
  2. setlocal EnableDelayedExpansion
  3. FOR /F %%I IN ("%0") DO SET BATDIR=%%~dpI
  4. ECHO The batch file is located in directory %BATDIR%
  5. cls
  6.  
  7. find ".twitch.tv" C:\Windows\System32\drivers\etc\hosts && (
  8.     echo Twitch entry was found in HOSTS. If restreaming won't work, remove patch and run again or update key.
  9.     taskkill /f /IM %BATDIR%\nginx.exe > nul 2> nul
  10.     start %BATDIR%\nginx.exe
  11.     timeout 10
  12. ) || (
  13.  
  14. :repeatserverselection
  15.     cls
  16.     echo Twitch entry was NOT found in HOSTS.
  17.     echo.
  18.     Echo Select donor TWITCH server you WILL NOT USE yourself:
  19.     echo.
  20.     Echo 1 - Helsinki -- EUROPE
  21.     Echo 2 - Hong-Kong - ASIA
  22.     Echo 3 - Sao Paulo - SOUTH AMERIKA
  23.     echo.
  24.     SET /P donorserver="Server number: "
  25.  
  26.     If "!donorserver!" == "1" (
  27.         set serverURL=live-hel.twitch.tv
  28.         goto serverisselected
  29.     )
  30.     If "!donorserver!" == "2" (
  31.         set serverURL=live-hkg.twitch.tv
  32.         goto serverisselected
  33.     )
  34.     If "!donorserver!" == "3" (
  35.         set serverURL=live-sao.twitch.tv
  36.         goto serverisselected
  37.     )
  38.     goto repeatserverselection
  39.  
  40. :serverisselected
  41.     cls
  42.     Echo You have selected !serverURL! as your donor server. Patching hosts now...
  43.     echo.>> C:\Windows\System32\drivers\etc\hosts
  44.     echo | set /P = "127.0.0.1      !serverURL!">> C:\Windows\System32\drivers\etc\hosts
  45.     echo ^^^^^^^^ finished patching HOSTS
  46.     echo.
  47.  
  48.     del %BATDIR%\conf\nginx.conf
  49.     TYPE %BATDIR%\temp\conftemplate.conf >> %BATDIR%\conf\nginx.conf
  50.     call %BATDIR%/temp/ServerSelector.bat
  51.  
  52.  
  53. :repeatkeyinput
  54.     echo.
  55.     echo Copy your key from restream.io and paste it with right mouse button
  56.     SET /P streamkey="Restream key: "
  57.     echo streamkey is set to "!streamkey!"
  58.     if "!streamkey!"=="" goto repeatkeyinput
  59.  
  60.     echo !streamkey!>> %BATDIR%\conf\nginx.conf
  61.     echo ;}}} >> %BATDIR%\conf\nginx.conf
  62.  
  63.     echo.
  64.     echo.
  65.     echo Patching is done. Now START the server and stream to !serverURL! of Twitch to stream through Restream to multiple platforms.
  66.  
  67.     timeout 10
  68. )
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement