@echo off chcp 65001 >nul REM Usage: kill-port.bat 8101 REM kill-port.bat 8101 /force (skip confirm, kill directly) REM No argument -> prompts for the port number. setlocal set "PORT=%~1" set "EXTRA=" if /I "%~2"=="/force" set "EXTRA=-Force" if "%PORT%"=="" ( set /p "PORT=Enter port to release: " ) if "%PORT%"=="" ( echo No port entered. Exit. exit /b 1 ) powershell -NoProfile -ExecutionPolicy Bypass -File "%~dp0kill-port.ps1" -Port %PORT% %EXTRA% endlocal