@echo off REM ============================================================ REM open-firewall.bat - opens port 8080 in the Windows Firewall. REM Run as administrator (once). Or just launch it: it will request REM admin rights itself. REM ============================================================ cd /d "%~dp0" REM Admin check + auto-elevate. net session >nul 2>nul if errorlevel 1 ( echo Requesting administrator rights ... powershell -Command "Start-Process -FilePath '%~f0' -Verb RunAs" exit /b ) set PORT=8080 set RULE=web-vnc echo Removing the old rule (if any) ... netsh advfirewall firewall delete rule name="%RULE%" >nul 2>nul echo Adding an allow rule for inbound TCP traffic on port %PORT% ... netsh advfirewall firewall add rule name="%RULE%" dir=in action=allow protocol=TCP localport=%PORT% if errorlevel 1 ( echo [error] Could not add the rule. pause exit /b 1 ) echo. echo Done. Port %PORT% is open for inbound connections. echo You can now connect to web-vnc from other machines on the network at: echo http://THIS_MACHINE_IP:%PORT% echo. pause