I use the following command
netstat -ano -p tcp | findstr "18812"
and got result like this:
TCP 0.0.0.0:18812 0.0.0.0:0 LISTENING 3116 TCP 127.0.0.1:3099 127.0.0.1:18812 ESTABLISHED 5112 TCP 127.0.0.1:18812 127.0.0.1:3099 ESTABLISHED 3116
But the line 2 is not what I want,i.e: I want the lines which the source port is 18812, rather than the dst port .
Any body knows how to deal with this? Thanks very much!
Edit: I tried regular expression, but “\d”,”+”,”\s” seems not work
One small improvement to the solution in your comment to fedmich. Probably not needed for port 18812 since the max number of digits is 5, and you’ve used all of them. But if you are looking for a 4 digit port (or smaller), you will want to make sure there is a space after the port number.
For example, if you were looking for source port 3099