При запуске новых сервисов в Windows, вы можете обнаружить что нужный порт уже занят (слушается) другой программой (процессом). Разберемся, как определить какая программ прослушивает определенный TCP или UDP порт в Windows.
Например, вы не можете запустить сайт IIS на стандартном 80 порту в Windows, т.к. этот порт сейчас занят (при запуске нескольких сайтов в IIS вы можете запускать их на одном или на разных портах). Как найти службу или процесс, который занял этот порт и завершить его?
Чтобы вывести полный список TCP и UDP портов, которые прослушиваются вашим компьютером, выполните команду:
netstat -aon| find "LIST"
Или вы можете сразу указать искомый номер порта:
netstat -aon | findstr ":80" | findstr "LISTENING"
Используемые параметры команды netstat:
- a – показывать сетевые подключения и открытые порты
- o – выводить идентфикатор професса (PID) для каждого подключения
- n – показывать адреса и номера портов в числовом форматер
По выводу данной команды вы можете определить, что 80 порт TCP прослушивается (статус
LISTENING
) процессом с PID 16124.
Вы можете определить исполняемый exe файл процесса с этим PID с помощью Task Manager или с помощью команды:
tasklist /FI "PID eq 16124"
Можно заменить все указанные выше команды одной:
for /f "tokens=5" %a in ('netstat -aon ^| findstr :80') do tasklist /FI "PID eq %a"
С помощью однострочной PowerShell команды можно сразу получить имя процесса, который прослушивает:
- TCP порт:
Get-Process -Id (Get-NetTCPConnection -LocalPort 80).OwningProcess
- UDP порт:
Get-Process -Id (Get-NetUDPEndpoint -LocalPort 53).OwningProcess
Можно сразу завершить этот процесс, отправив результаты через pipe в командлет Stop-Process:
Get-Process -Id (Get-NetTCPConnection -LocalPort 80).OwningProcess| Stop-Process
Проверьте, что порт 80 теперь свободен:
Test-NetConnection localhost -port 80
Чтобы быстрой найти путь к исполняемому файлу процесса в Windows, используйте команды:
cd /
dir tiny.exe /s /p
Или можно для поиска файла использовать встроенную команду where :
where /R C:\ tiny
В нашем случае мы нашли, что исполняемый файл
tiny.exe
(легкий HTTP сервер), который слушает 80 порт, находится в каталоге c:\Temp\tinyweb\tinyweb-1-94
Last Updated :
09 Apr, 2025
Open ports on your Windows computer act like doors for data-letting information in and out. While necessary for apps and services, unprotected ports can become security risks. Checking which ports are open helps you spot vulnerabilities, fix connection issues, and keep your system safe.
Using Command Prompt (CMD), you can quickly see active ports with simple built-in commands—no extra tools needed. This guide walks you through the steps to check open ports in Windows, understand the results, and close any unnecessary ones.
Whether you’re troubleshooting a network problem or guarding against threats, these CMD techniques give you control over your system’s security.
How to Check Open Ports Using CMD in Windows
Make sure that the essential ports are allowed or blocked by your firewall system configuration. The Control Panel’s Windows Firewall settings allow you to control all the initial processes for system requirements. If you discover the open ports that ought to be closed within the system, you might want to halt the related service or change the in-build configuration of the program that opened the port manually.
Now, see the below-mentioned steps and implement them to Check Open Ports Using CMD in Windows.
Step 1: Open CMD or Command Prompt
- Press Win + R from your keyboard > Type cmd > Click on the Enter button
Step 2: Implement the «netstat» Command
An effective tool for keeping an eye on open ports within the system and configured network connections is the netstat command to simplify. It offers comprehensive details on all open connections and system servers, such as the protocol in use, and local and international addresses to control or verify all the connection’s status.
- Type the below command in the cmd to check the open port functions > Press Enter
netstat -an | find "LISTEN"
- See the output below
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING
TCP 0.0.0.0:902 0.0.0.0:0 LISTENING
In this case, 0.0.0.0 designates that all pre-processed network interfaces are listening on the port, which is open for the internal system server. The port number is the number that comes after the colon of the system commands (e.g., 135, 445, 3389).
Step 3: Observe the functional Process Using the Port
- Write the following command to identify which application or process is using a specific port within the system.
netstat -ano | find "LISTEN"
An extra -o flag is included with this command while processed, which shows the Process ID (PID) connected to each port manually.
- See the output within a PID column
TCP 0.0.0.0:135 0.0.0.0:0 LISTENING 1160
TCP 0.0.0.0:445 0.0.0.0:0 LISTENING 4
- Search and Open Task Manager > Go to Details option > See the PID column
Step 4: Check Specific Port in cmd
- You can change the implemented command to focus on a particular port if you want to see if it’s open or not within the system configuration. For instance, use this to see if port 60 is open to identify the process:
netstat -an | find ":60"
- See the final entry below —
TCP 0.0.0.0:40 0.0.0.0:0 LISTENING
Conclusion
Using Windows’ CMD to check all the internal open ports is a simple yet effective method for network management, security control, and troubleshooting issues identification. You can safeguard your system from external potential dangers and make sure your connected network is operating efficiently by routinely checking open ports within the system. The netstat command is an invaluable resource for any IT professional or developer toolset, especially when paired with a basic understanding of ports and processes of all the initial implementations.
Also Read
- How to check Active Network Connections in Windows?
- Ways to Find Out List of All Open Ports in Linux
3 minute read
Can’t use a specific port? Here’s how to check which port is in use in Windows with simple commands and apps like currports and tcpview.
Windows has many applications connected or trying to connect to the internet at any point in time. With all those applications, it is only natural that they use many network ports.
Two or more applications may need the same port to work from time to time. When that specific port is already in use by one application, the other application cannot use that port, and it may show a warning message, error out, or crash entirely.
In those situations, it is better to know which ports are used and which application is using that specific port. That way, you can either change the port or terminate the problem-causing application so that the other one works as it should.
The good thing is that it is pretty easy to know which port is used by which application in Windows. So, without further ado, let me show the steps to find which ports are used in Windows 10 and 11 operating systems.
Note: The methods shown below work in Windows 7, 8, 10, and 11.
Command to check ports in
Using a single command, you can get a list of all the ports in use by various programs. This method is quite helpful if you want to take a quick glance at the ports in use.
-
Search for “cmd” in the start menu, right-click on the Command Prompt and select “Run as Administrator.” This option lets you open the command prompt with admin rights.
- In the elevated command prompt window, execute the below command. You can copy and paste the command into the Command Prompt window by right-clicking inside it.
- You will see the port number right next to the IP address (ex: 192.168.42.198:50943) in the output result. You can see the highlighted portion of the attached image for better representation.
Keep in mind that the list will not be refreshed automatically. You have to execute the command again when you need an updated list. If you want the used port list to be updated automatically, follow one of the two methods illustrated below.
Use CurrPorts to find ports in use
Nirsoft Utilities has a pretty neat and lightweight tool called CurrPorts. It shows all the ports used by Windows and other programs. Let me show you how to use the application to get the information you need.
A quick note: In case you don’t know, Nirsoft has a lot of small and portable apps that are pretty useful in day-to-day life. If you’ve never used Nirsoft Utilities, browse the developer site and find many interesting little tools.
-
First, download CurrPorts from the official website. Being a portable application, you don’t have to install it. After downloading, extract the exe file from the zip file and double-click the file to open it.
-
As soon as you open the window, the application will list all the connections and their ports. You can find the port number under the Local Port section.
-
Being a dedicated port monitoring application, it offers quite a few options to manage the applications and ports. Right-click on any option, and you will see appropriate options like the ability to close the TCP connection, copying properties, application properties, etc.
-
If you want finer control, you can create your own filters to narrow down the search. To do that, select “Options -> Advanced Filters” option.
Use Sysinternals TCPView to check ports in use
Sysinternals TCPView is a Microsoft tool that makes it easy to view all the TCP connections and ports used in Windows 10 and 11. The tool is very similar to CurrPorts.
-
Download TCPView from the Sysinternals website, extract the exe file to your desktop, and double-click on it.
-
As soon as you open the application, you will see a user agreement. Agree to the agreement, and you will instantly see all the TCP connections and ports in use. You will find the port numbers under the Local Port section.
-
You can end the connection and free the port if you want to. To do that, right-click on the connection and select “End Process.” This will terminates the process.
Quick Links
-
Use Built-In Tools to See What Is Listening on a Port
-
Use NirSoft CurrPorts to View What is Listening on a Port
Summary
- Run the command «netstat -ab» in an elevated Command Prompt, PowerShell, or Terminal window to see a list of applications and their associated ports. This works in Windows 11 too.
- Checking open ports can be done using built-in tools like Command Prompt or PowerShell, which list active ports and the associated process names or identifiers.
- The freeware application CurrPorts by NirSoft provides an easier way to view what is listening on a port, displaying detailed information about the process and allowing for better management of ports.
Whenever an application wants to make itself accessible over the network, it claims a TCP/IP port, which means that port can’t be used by anything else. So how do you check open ports to see what application is already using it?
We’ve tested this process and confirmed that all of the steps are up-to-date, and that they all work in Windows 11, too.
How Do Ports Work?
An IP address specifies a computer — or other network device — on a network. When one device sends traffic to another, the IP address is used to route that traffic to the appropriate place. Once the traffic reaches the right place, the device needs to know which app or service to send the traffic on to. That’s where ports come in.
If the IP address is akin to a street address on a piece of mail, the port is something like the name of the person at that residence who gets the mail. For the most part, you don’t need to worry about ports. But once in a while, you might encounter an app that’s set to listen for traffic on the same port that another app already has in use. In that case, you’ll need to identify the app that already has that port in use.
There are a number of ways to tell what application has a port locked, but we’re going to walk you through a couple of built-in ways that use the Command Prompt, PowerShell, or the Terminal, and then show you a great freeware application that makes it even easier. All these methods should work no matter which version of Windows you use.
We’ve got two commands to show you. The first lists active ports along with the name of the process that’s using them. Most of the time, that command will work fine. Sometimes, though, the process name won’t help you identify what app or service actually has a port tied up. For those times, you’ll need to list active ports along with their process identifier numbers and then look those processes up in Task Manager.
Option One: View Port Use Along with Process Names
First, you’ll need to open the Command Prompt in administrator mode. Hit Start, and then type «command» into the search box. When you see «Command Prompt» appear in the results, right-click it and choose «Run as administrator,» or click «Run as Administrator» on the right.
You can also use PowerShell or Terminal for this.
At the Command Prompt, type the following text and then hit Enter:
netstat -ab
After you hit Enter, the results may take a minute or two to fully display, so be patient. Scroll through the list to find the port (which is listed after the colon to the right of the local IP address), and you’ll see the process name listed under that line. If you’d like to make things a little easier, remember that you can also pipe the results of the command to a text file. You could then just search the text file for the port number you’re after.
Here, for example, you can see that port 49902 is tied up by a process named picpick.exe. PicPick is an image editor on our system, so we can assume the port is actually tied up by the process that regularly checks for updates to the app.
Option Two: View Port Use Along with Process Identifiers
If the name of the process for the port number you’re looking up makes it difficult to tell what the related app is, you can try a version of the command that shows process identifiers (PIDs) rather than names. Type the following text at the Command Prompt, and then hit Enter:
netstat -aon
The column at the far right lists PIDs, so just find the one that’s bound to the port that you’re trying to troubleshoot.
Next, open up Task Manager by right-clicking any open space on your taskbar and choosing «Task Manager.» You can also hit Ctrl+Shift+Esc.
If you’re using Windows 8, 10, or 11 switch to the «Details» tab in Task Manager.
In older versions of Windows, you’ll see this information on the «Processes» tab. Sort the list of process by the «PID» column and find the PID associated with the port you’re investigating. You might be able to tell more about what app or service has the port tied up by looking at the «Description» column.
If not, right-click the process and choose «Open file location.» The location of the file will likely give you clues as to what app is involved.
When Once you’re there, you can use the End Process, Open File Location, or Go to Service(s) options to control the process or stop it.
Use NirSoft CurrPorts to View What is Listening on a Port
If you aren’t really the Command Prompt type — or you’d rather just use a simple utility to do all this in one step — we recommend the excellent freeware CurrPorts utility by NirSoft. Go ahead and download the tool. Just make sure you get the right version (the regular version is for 32-bit Windows and the x64 version is for 64-bit Windows). It’s a portable app, so you won’t need to install it. Just unzip the download folder and run executable.
In the CurrPorts window, sort by the «Local Port» column, find the port you’re investigating, and you can see everything — the process name, PID, port, the full path to the process, and so on.
To make it even easier, double-click on any process to see every single detail in one window.
When you’ve determined what app or service has the port you’re investigating tied up, it’s up to you how to handle it. If it’s an app, you may have the option to specify a different port number. If it’s a service — or you don’t have the option to specify a different port number — you’ll likely have to stop the service or remove the app.
Last year we suffered the BitCoin miner virus which locked our computer and levied a ransom. And yet, the main reason for the spread of the virus was that the unused ports did not close. So, to guard against happening again, we have to determine what ports are being used in windows and then turn it off.
What is a Port?
When it comes to port, it’s necessary to talk about IP as well. Let me draw an analogy to describe the relationship between the Port and IP. Once upon a time, if you want to send a letter to your friend in a faraway place, you need to write down your address and his address on the envelope. The envelope is amount to the data package while both addresses are amount to IP. When the postman sends the letter to your friend’s house, and if your friend opens the door to get it, now the door is equal to the port. If your friend doesn’t open the door, that is to say, the port closed. After that, the letter will be sent back to you. In network technology, ports divide into two classes. One is a physical port, such as USB port. The second is the logical port, which generally refers to the port in the TCP/IP protocol. These port will cause some virus and harm your PC. As a result, there is necessary to check if the port is open.
Step 1: Hit Windows + R to invoke Run dialog and type cmd to open Command Prompt.
Step 2: Type netstat -ano to list states of all ports.
Alternatively, type telnet <IP address> <Port> to check if port is open.
Step 3: Locate to the target port and view the corresponding PID in the final column. For example, the PID of port 2179 is 3800.
Step 4: Input tasklist|findstr “3800” and hit Enter on the keyboard to view which service takes up the port.
Step 5: To end up this service, run taskkill /f /t /im vmms.exe.