cmd 查看端口

1、Windows平台
在windows命令行窗口下执行:

C:\>netstat -ano|findstr "1025"

TCP    127.0.0.1:1025         0.0.0.0:0              LISTENING       944


端口被进程号为944的进程占用,继续执行下面命令:

C:\>tasklist |findstr "944"

alg.exe                     944 Console                 0     3,912 K

呵呵。alg占用了你的端口。

②:批处理方式
@echo off 
netstat -a -n > a.txt 
type a.txt | find "1433" && echo "系统已经开启指定的端口!" 
del a.txt 
pause & exit 

你可能感兴趣的:(C++,c,windows,C#)