---
title: "cmd 查看端口"
author: "ileson"
date: "2011-04-27T12:11:41Z"
tags: []
categories: ["操作系统"]
slug: "cmd"
draft: false
lastmod: "2013-07-04T12:24:36Z"
id: 1019606
url: "https://ileson.iteye.com/blog/1019606"
---

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

```CMD
C:\>netstat -ano|findstr "1025"

TCP    127.0.0.1:1025         0.0.0.0:0              LISTENING       944
```


端口被进程号为944的进程占用，继续执行下面命令：


```CMD
C:\>tasklist |findstr "944"

alg.exe                     944 Console                 0     3,912 K
```

呵呵。alg占用了你的端口。

②:批处理方式

```bat

@echo off 
netstat -a -n > a.txt 
type a.txt | find "1433" && echo "系统已经开启指定的端口！" 
del a.txt 
pause & exit 

```