Skip to content

Instantly share code, notes, and snippets.

@topolik
Last active April 24, 2020 17:49
Show Gist options
  • Save topolik/bb846999ca8afef89b0cb820d364b75c to your computer and use it in GitHub Desktop.
Save topolik/bb846999ca8afef89b0cb820d364b75c to your computer and use it in GitHub Desktop.
@echo off
for /f "delims=[] tokens=2" %%a in ('ping -4 -n 1 %ComputerName% ^| findstr [') do set NetworkIP=%%a
echo Network IP: %NetworkIP%
netsh interface ipv4 install
netsh interface portproxy show all
netsh advfirewall firewall show rule name="Minecraft Proxy 12345"
set /p "port=Zadej port: "
netsh interface portproxy del v4tov4 listenport=12345 listenaddress=0.0.0.0
netsh advfirewall firewall delete rule name="Minecraft Proxy 12345"
if not "%port%" == "" (
netsh advfirewall firewall add rule name="Minecraft Proxy 12345" dir=in action=allow protocol=TCP localport=12345
netsh interface portproxy add v4tov4 listenport=12345 connectaddress=%NetworkIP% listenaddress=0.0.0.0 connectport=%port%
)
netsh interface portproxy show all
netsh advfirewall firewall show rule name="Minecraft Proxy 12345"
pause
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment