@echo off
call:endpoint tcp
call:endpoint udp
exit /b
:endpoint
<nul set /p res=%1: & (netstat -an | find /i /c "%1")
exit /b 0
Diff to Previous Revision
--- revision 1 2012-11-19 08:35:07
+++ revision 2 2013-10-10 16:26:33
@@ -1,12 +1,8 @@
@echo off
- call:count TCP
- call:count UDP
+ call:endpoint tcp
+ call:endpoint udp
exit /b
-:count
- for /f "tokens=1" %%i in ('netstat -an^
- ^| find /c "%1"') do (
- if "%1" equ "" goto:eof
- echo Totaly %1 endpoints: %%i
- )
+:endpoint
+ <nul set /p res=%1: & (netstat -an | find /i /c "%1")
exit /b 0