sneaky4oe icon

PATCH-FIRST-RUN-ADMIN.bat

sneaky4oe | PRO | 06/20/18 08:10:03 PM UTC | 0 ⭐ | 506 👁️ | Never ⏰ | []
Batch |

1.89 KB

|

None

|

0 👍

/

0 👎

@echo off
setlocal EnableDelayedExpansion
FOR /F %%I IN ("%0") DO SET BATDIR=%%~dpI
ECHO The batch file is located in directory %BATDIR%
cls
 
find ".twitch.tv" C:\Windows\System32\drivers\etc\hosts && (
    echo Twitch entry was found in HOSTS. If restreaming won't work, remove patch and run again or update key.
    taskkill /f /IM %BATDIR%\nginx.exe > nul 2> nul
    start %BATDIR%\nginx.exe
    timeout 10
) || (
 
:repeatserverselection
    cls
    echo Twitch entry was NOT found in HOSTS.
    echo.
    Echo Select donor TWITCH server you WILL NOT USE yourself:
    echo.
    Echo 1 - Helsinki -- EUROPE
    Echo 2 - Hong-Kong - ASIA
    Echo 3 - Sao Paulo - SOUTH AMERIKA
    echo.
    SET /P donorserver="Server number: "
 
    If "!donorserver!" == "1" (
        set serverURL=live-hel.twitch.tv
        goto serverisselected
    )
    If "!donorserver!" == "2" (
        set serverURL=live-hkg.twitch.tv
        goto serverisselected
    )
    If "!donorserver!" == "3" (
        set serverURL=live-sao.twitch.tv
        goto serverisselected
    )
    goto repeatserverselection
 
:serverisselected
    cls
    Echo You have selected !serverURL! as your donor server. Patching hosts now...
    echo.>> C:\Windows\System32\drivers\etc\hosts
    echo | set /P = "127.0.0.1      !serverURL!">> C:\Windows\System32\drivers\etc\hosts
    echo ^^^^^^^^ finished patching HOSTS
    echo.
 
    del %BATDIR%\conf\nginx.conf
    TYPE %BATDIR%\temp\conftemplate.conf >> %BATDIR%\conf\nginx.conf
    call %BATDIR%/temp/ServerSelector.bat
 
 
:repeatkeyinput
    echo.
    echo Copy your key from restream.io and paste it with right mouse button
    SET /P streamkey="Restream key: "
    echo streamkey is set to "!streamkey!"
    if "!streamkey!"=="" goto repeatkeyinput
 
    echo !streamkey!>> %BATDIR%\conf\nginx.conf
    echo ;}}} >> %BATDIR%\conf\nginx.conf
 
    echo.
    echo.
    echo Patching is done. Now START the server and stream to !serverURL! of Twitch to stream through Restream to multiple platforms.
 
    timeout 10
)

Comments