39 lines
831 B
Batchfile
39 lines
831 B
Batchfile
@echo off
|
|
setlocal
|
|
|
|
net session >nul 2>&1
|
|
if not "%errorlevel%"=="0" (
|
|
echo This script must be run as Administrator.
|
|
echo.
|
|
echo 1. Open Windows Start menu.
|
|
echo 2. Type cmd.
|
|
echo 3. Right-click Command Prompt and choose "Run as administrator".
|
|
echo 4. Run this command:
|
|
echo %~f0 %*
|
|
echo.
|
|
pause
|
|
exit /b 1
|
|
)
|
|
|
|
set SCRIPT_DIR=%~dp0
|
|
set WSL_IP=%~1
|
|
set PORT=%~2
|
|
|
|
if not "%WSL_IP%"=="" (
|
|
echo %WSL_IP% | findstr /R "^[0-9][0-9]*$" >nul
|
|
if not errorlevel 1 (
|
|
set PORT=%WSL_IP%
|
|
set WSL_IP=
|
|
)
|
|
)
|
|
|
|
if "%PORT%"=="" set PORT=8010
|
|
|
|
if "%WSL_IP%"=="" (
|
|
powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%setup_windows_portproxy.ps1" -Port %PORT%
|
|
) else (
|
|
powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%setup_windows_portproxy.ps1" -WslIp %WSL_IP% -Port %PORT%
|
|
)
|
|
|
|
endlocal
|