Go to run → type cmd → press Enter . (Note: Don't include square brackets.) Then cmd will give you the detail of the service running on that port along with the PID. Open Task Manager and hit the service tab and match the PID with that of the cmd, and that's it.
You can use "netstat" to check whether a port is available or not.
Use the netstat -anp | find "port number"
command to find whether a port is occupied by an another process or not. If it is occupied by an another process, it will show the process id of that process.
You have to put : before port number to get the actual output
Ex
netstat -anp | find ":8080"
It's netstat -ano|findstr port no
Result would show process id in last column
netstat -ano|find ":port_no"
will give you the list.
a: Displays all connections and listening ports.
n: Displays addresses and port numbers in numerical form.
o: Displays the owning process ID associated with each connection .
example : netstat -ano | find ":1900"
This gives you the result like this.
UDP 107.109.121.196:1900 *:* 1324
UDP 127.0.0.1:1900 *:* 1324
UDP [::1]:1900 *:* 1324
UDP [fe80::8db8:d9cc:12a8:2262%13]:1900 *:* 1324
It's (Get-NetTCPConnection -LocalPort "port no.").OwningProcess
If you prefer Powershell, use this. You will get the name of the process.
PS C:\Users\Administrator> Get-Process -Id (Get-NetTCPConnection -LocalPort 9093).OwningProcess
Handles NPM(K) PM(K) WS(K) CPU(s) Id SI ProcessName
------- ------ ----- ----- ------ -- -- -----------
6021 1464 2760976 2131548 290.39 25512 2 java
The PID is in Id
column, and it provides process name, as well.
If no process is using this port, you get a red error message.
If you want to kill the process with PID 25512, use
taskkill /PID 25512 /F
/F
means force, some processes cannot be killed without /F
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With