From 38b2412fa963c661aba320afef2b470d43f25f0d Mon Sep 17 00:00:00 2001 From: Brad Ganley Date: Mon, 13 May 2024 15:07:12 -0500 Subject: [PATCH] added options for count --- tcpcon.bat | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/tcpcon.bat b/tcpcon.bat index a81f4e2..309d3ef 100644 --- a/tcpcon.bat +++ b/tcpcon.bat @@ -4,12 +4,18 @@ cls echo Monitoring TCP Connections... echo. -set /p option="Enter 'a' for all TCP connections or 'e' for established connections: " + +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" /c:"Active Connections" + netstat -an | findstr /c:"TCP" ) else if "%option%"=="e" ( netstat -an | findstr /c:"ESTABLISHED" -)else ( +) else if "%option%"=="ac" ( + netstat -an | findstr /c:"TCP" /c:"Active Connections" +) else if "%option%"=="ec" ( + netstat -an | findstr /c:"ESTABLISHED" | find /c /v "" +) else ( echo Invalid option. Please try again. ) timeout /t 5 > nul