scripts/tcpcon.bat
2024-05-13 15:10:31 -05:00

24 lines
584 B
Batchfile

@echo off
:loop
cls
echo Monitoring TCP Connections...
echo.
set /p option="Enter 'a' for all TCP connections, 'e' for established connections, 'ac' for all connections count, or 'ec' for established connections count: "
if "%option%"=="a" (
netstat -an | findstr /c:"TCP"
) else if "%option%"=="e" (
netstat -an | findstr /c:"ESTABLISHED"
) else if "%option%"=="ac" (
netstat -an | find /c /v ""
) else if "%option%"=="ec" (
netstat -an | findstr /c:"ESTABLISHED" | find /c /v ""
) else (
echo Invalid option. Please try again.
)
timeout /t 5 > nul
goto loop