Is there a way to examine the status of a specific port from the Windows command line? I know I can use netstat to examine all ports but netstat is slow and looking at a specific port probably isn't.
相关问题
- Inheritance impossible in Windows Runtime Componen
- IPAddress.[Try]Parse parses 192.168 to 192.0.0.168
- how to get running process information in java?
- Is TWebBrowser dependant on IE version?
- How can I have a python script safely exit itself?
相关文章
- 如何让cmd.exe 执行 UNICODE 文本格式的批处理?
- 怎么把Windows开机按钮通过修改注册表指向我自己的程序
- Warning : HTML 1300 Navigation occured?
- Bundling the Windows Mono runtime with an applicat
- Windows 8.1 How to fix this obsolete code?
- RMI Threads prevent JVM from exiting after main()
- CosmosDB emulator can't start since port is al
- fsc.exe is very slow because it tries to access cr
I use:
here o represents process ID. now you can do whatever with the process ID. To terminate the process, for e.g., use:
As noted elsewhere: use netstat, with appropriate switches, and then filter the results with find[str]
Most basic:
or
To find a foreign port you could use:
To find a local port you might use:
Where N is the port number you are interested in.
-n
ensures all ports will be numerical, i.e. not returned as translated to service names.-a
will ensure you search all connections (TCP, UDP, listening...)In the
find
string you must include the colon, as the port qualifier, otherwise the number may match either local or foreign addresses.You can further narrow narrow the search using other netstat switches as necessary...
Further reading (^0^)
To improve upon @EndUzr's response:
To find a foreign port (IPv4 or IPv6) you can use:
To find a local port (IPv4 or IPv6) you can use:
Where N is the port number you are interested in. The "/r" switch tells it to process it as regexp. The "/c" switch allows findstr to include spaces within search strings instead of treating a space as a search string delimiter. This added space prevents longer ports being mistreated - for example, ":80" vs ":8080" and other port munging issues.
To list remote connections to the local RDP server, for example:
Or to see who is touching your DNS:
If you want to exclude local-only ports you can use a series of exceptions with "/v" and escape characters with a backslash:
For Windows 8 User : Open Command Prompt, type netstat -an | find "your port number" , enter .
If reply comes like LISTENING then the port is in use, else it is free .
This command will show all the ports and their destination address: