<p>How do I find out which process is listening on a TCP or UDP port on Windows?</p>

[{'answer_id': 48199, 'author': 'Brad Wilson', 'author_id': 1554, 'author_profile': 'https://Stackoverflow.com/users/1554', 'pm_score': 13, 'selected': True, 'text': '<h1><a href="https://en.wikipedia.org/wiki/PowerShell" rel="noreferrer">PowerShell</a></h1>\n<h2>TCP</h2>\n<pre><code>Get-Process -Id (Get-NetTCPConnection -LocalPort YourPortNumberHere).OwningProcess\n</code></pre>\n<h2>UDP</h2>\n<pre><code>Get-Process -Id (Get-NetUDPEndpoint -LocalPort YourPortNumberHere).OwningProcess\n</code></pre>\n<h1><a href="https://en.wikipedia.org/wiki/Cmd.exe" rel="noreferrer">cmd</a></h1>\n<pre><code> netstat -a -b\n</code></pre>\n<p>(Add <strong>-n</strong> to stop it trying to resolve hostnames, which will make it a lot faster.)</p>\n<p>Note Dane\'s recommendation for <a href="http://technet.microsoft.com/en-us/sysinternals/bb897437.aspx" rel="noreferrer">TCPView</a>. It looks very useful!</p>\n<p><strong>-a</strong>  Displays all connections and listening ports.</p>\n<p><strong>-b</strong>  Displays the executable involved in creating each connection or listening port. In some cases well-known executables host multiple independent components, and in these cases the sequence of components involved in creating the connection or listening port is displayed. In this case the executable name is in [] at the bottom, on top is the component it called, and so forth until TCP/IP was reached. Note that this option can be time-consuming and will fail unless you have sufficient permissions.</p>\n<p><strong>-n</strong>  Displays addresses and port numbers in numerical form.</p>\n<p><strong>-o</strong>  Displays the owning process ID associated with each connection.</p>\n'}, {'answer_id': 48202, 'author': 'aku', 'author_id': 1196, 'author_profile': 'https://Stackoverflow.com/users/1196', 'pm_score': 8, 'selected': False, 'text': '<p>For Windows:</p>\n\n<pre><code>netstat -aon | find /i "listening"\n</code></pre>\n'}, {'answer_id': 48207, 'author': 'Dane', 'author_id': 2929, 'author_profile': 'https://Stackoverflow.com/users/2929', 'pm_score': 8, 'selected': False, 'text': '<p>Use <a href="http://technet.microsoft.com/en-us/sysinternals/bb897437.aspx" rel="noreferrer">TCPView</a> if you want a GUI for this. It\'s the old <a href="https://en.wikipedia.org/wiki/Sysinternals" rel="noreferrer">Sysinternals</a> application that Microsoft bought out.</p>\n'}, {'answer_id': 48208, 'author': 'David Webb', 'author_id': 3171, 'author_profile': 'https://Stackoverflow.com/users/3171', 'pm_score': 4, 'selected': False, 'text': '<p>If you\'d like to use a GUI tool to do this there\'s <a href="http://technet.microsoft.com/en-us/sysinternals/bb897437.aspx" rel="nofollow noreferrer">Sysinternals\' TCPView</a>.</p>\n'}, {'answer_id': 13281291, 'author': 'Cyborg', 'author_id': 1775540, 'author_profile': 'https://Stackoverflow.com/users/1775540', 'pm_score': 6, 'selected': False, 'text': '<ol>\n<li><p>Open a command prompt window (as Administrator) From "Start\\Search box" Enter "cmd" then right-click on "cmd.exe" and select "Run as Administrator"</p></li>\n<li><p>Enter the following text then hit Enter.</p>\n\n<h2><code>netstat -abno</code></h2>\n\n<p><strong>-a</strong>          Displays all connections and listening ports.</p>\n\n<p><strong>-b</strong>          Displays the executable involved in creating each connection or\n            listening port. In some cases well-known executables host\n            multiple independent components, and in these cases the\n            sequence of components involved in creating the connection\n            or listening port is displayed. In this case the executable\n            name is in [] at the bottom, on top is the component it called,\n            and so forth until TCP/IP was reached. Note that this option\n            can be time-consuming and will fail unless you have sufficient\n            permissions.</p>\n\n<p><strong>-n</strong>          Displays addresses and port numbers in numerical form.</p>\n\n<p><strong>-o</strong>          Displays the owning process ID associated with each connection.</p></li>\n<li><p>Find the Port that you are listening on under "Local Address"</p></li>\n<li><p>Look at the process name directly under that.</p></li>\n</ol>\n\n<p>NOTE: To find the process under Task Manager</p>\n\n<ol>\n<li><p>Note the PID (process identifier) next to the port you are looking at.</p></li>\n<li><p>Open Windows Task Manager. </p></li>\n<li><p>Select the Processes tab. </p></li>\n<li><p>Look for the PID you noted when you did the netstat in step 1.</p>\n\n<ul>\n<li><p>If you don’t see a PID column, click on View / Select Columns. Select PID.</p></li>\n<li><p>Make sure “Show processes from all users” is selected.</p></li>\n</ul></li>\n</ol>\n'}, {'answer_id': 18175357, 'author': 'Perl Fanatic', 'author_id': 2375759, 'author_profile': 'https://Stackoverflow.com/users/2375759', 'pm_score': 3, 'selected': False, 'text': '<p>Follow these tools: From <strong>cmd</strong>: <code>C:\\&gt; netstat -anob</code> with <strong>Administrator</strong> privileges.</p>\n<p><a href="http://technet.microsoft.com/en-us/sysinternals/bb896653" rel="nofollow noreferrer">Process Explorer</a></p>\n<p><a href="http://technet.microsoft.com/en-us/sysinternals/bb896645" rel="nofollow noreferrer">Process Dump</a></p>\n<p><a href="http://technet.microsoft.com/en-us/sysinternals/bb896644" rel="nofollow noreferrer">Port Monitor</a></p>\n<p>All from sysinternals.com.</p>\n<p>If you just want to know process running and threads under each process, I recommend learning about <code>wmic</code>. It is a wonderful command-line tool, which gives you much more than you can know.</p>\n<p>Example:</p>\n<pre><code>c:\\&gt; wmic process list brief /every:5\n</code></pre>\n<p>The above command will show an all process list in brief every 5 seconds. To know more, you can just go with <code>/?</code> command of windows , for example,</p>\n<pre><code>c:\\&gt; wmic /?\nc:\\&gt; wmic process /?\nc:\\&gt; wmic prcess list /?\n</code></pre>\n<p>And so on and so forth. :)</p>\n'}, {'answer_id': 18199735, 'author': 'nisha', 'author_id': 468964, 'author_profile': 'https://Stackoverflow.com/users/468964', 'pm_score': 3, 'selected': False, 'text': '<p>Use:</p>\n\n<pre><code>netstat -a -o\n</code></pre>\n\n<p>This shows the PID of the process running on a particular port.</p>\n\n<p>Keep in mind the process ID and go to Task Manager and services or details tab and end the process which has the same PID.</p>\n\n<p>Thus you can kill a process running on a particular port in Windows.</p>\n'}, {'answer_id': 19255965, 'author': 'Nathan24', 'author_id': 1840368, 'author_profile': 'https://Stackoverflow.com/users/1840368', 'pm_score': 7, 'selected': False, 'text': '<p>You can get more information if you run the following command:</p>\n\n<pre><code>netstat -aon | find /i "listening" |find "port"\n</code></pre>\n\n<p>using the \'Find\' command allows you to filter the results. <code>find /i "listening"</code> will display only ports that are \'Listening\'. Note, you need the <code>/i</code> to ignore case, otherwise you would type find "LISTENING". <code>| find "port"</code> will limit the results to only those containing the specific port number. Note, on this it will also filter in results that have the port number anywhere in the response string.</p>\n'}, {'answer_id': 22389550, 'author': 'Tony Delroy', 'author_id': 410767, 'author_profile': 'https://Stackoverflow.com/users/410767', 'pm_score': 4, 'selected': False, 'text': '<p><code>netstat -ao</code> and <code>netstat -ab</code> tell you the application, but if you\'re not a system administrator  you\'ll get "The requested operation requires elevation".</p>\n\n<p>It\'s not ideal, but if you use Sysinternals\' <a href="https://en.wikipedia.org/wiki/Process_Explorer" rel="nofollow noreferrer">Process Explorer</a> you can go to specific processes\' properties and look at the TCP tab to see if they\'re using the port you\'re interested in. It is a bit of a needle and haystack thing, but maybe it\'ll help someone...</p>\n'}, {'answer_id': 23136177, 'author': 'Monis Majeed', 'author_id': 3335813, 'author_profile': 'https://Stackoverflow.com/users/3335813', 'pm_score': 5, 'selected': False, 'text': '<p>To get a list of all the owning process IDs associated with each connection:</p>\n\n<pre><code>netstat -ao |find /i "listening"\n</code></pre>\n\n<p>If want to kill any process have the ID and use this command, so that port becomes free</p>\n\n<pre><code>Taskkill /F /IM PID of a process\n</code></pre>\n'}, {'answer_id': 23718720, 'author': 'bcorso', 'author_id': 1290264, 'author_profile': 'https://Stackoverflow.com/users/1290264', 'pm_score': 11, 'selected': False, 'text': '<p>There\'s a native GUI for Windows:</p>\n<ul>\n<li><p>Start menu → <em>All Programs</em> → <em>Accessories</em> → <em>System Tools</em> → <em>Resource Monitor</em></p>\n</li>\n<li><p>or run <code>resmon.exe</code>,</p>\n</li>\n<li><p>or from <em>TaskManager</em> → <em>Performance</em> tab.</p>\n</li>\n</ul>\n<p><img src="https://i.stack.imgur.com/I2UzJ.png" alt="Enter image description here" /></p>\n'}, {'answer_id': 25463469, 'author': 'Pankaj Pateriya', 'author_id': 1989851, 'author_profile': 'https://Stackoverflow.com/users/1989851', 'pm_score': 6, 'selected': False, 'text': '<p>First we find the process id of that particular task which we need to eliminate in order to get the port free:</p>\n\n<p>Type  </p>\n\n<pre><code>netstat -n -a -o\n</code></pre>\n\n<p>After executing this command in the Windows command line prompt (cmd), select the pid which I think the last column. Suppose this is 3312.</p>\n\n<p>Now type</p>\n\n<pre><code>taskkill /F /PID 3312\n</code></pre>\n\n<p>You can now cross check by typing the <code>netstat</code> command.</p>\n\n<p>NOTE: sometimes Windows doesn’t allow you to run this command directly on CMD, so first you need to go with these steps:</p>\n\n<p>From the start menu -> command prompt (right click on command prompt, and run as administrator)</p>\n'}, {'answer_id': 31126389, 'author': 'Josh', 'author_id': 2718874, 'author_profile': 'https://Stackoverflow.com/users/2718874', 'pm_score': 3, 'selected': False, 'text': '<p>I recommend <a href="http://www.nirsoft.net/utils/cports.html" rel="noreferrer">CurrPorts</a> from NirSoft.</p>\n\n<p>CurrPorts can filter the displayed results. <a href="https://technet.microsoft.com/en-us/sysinternals/tcpview.aspx" rel="noreferrer">TCPView</a> doesn\'t have this feature.</p>\n\n<p>Note: You can right click a process\'s socket connection and select "Close Selected TCP Connections" (You can also do this in TCPView). This often fixes connectivity issues I have with Outlook and Lync after I switch VPNs. With CurrPorts, you can also close connections from the command line with the "/close" parameter.</p>\n'}, {'answer_id': 35312370, 'author': 'ROMANIA_engineer', 'author_id': 3885376, 'author_profile': 'https://Stackoverflow.com/users/3885376', 'pm_score': 6, 'selected': False, 'text': '<h3>Get PID and Image Name</h3>\n\n<p>Use only one command:</p>\n\n<pre><code>for /f "tokens=5" %a in (\'netstat -aon ^| findstr 9000\') do tasklist /FI "PID eq %a"\n</code></pre>\n\n<p>where <code>9000</code> should be replaced by your port number.</p>\n\n<p>The <strong>output</strong> will contain something like this:</p>\n\n<pre><code>Image Name                     PID Session Name        Session#    Mem Usage\n========================= ======== ================ =========== ============\njava.exe                      5312 Services                   0    130,768 K\n</code></pre>\n\n<hr>\n\n<p><strong>Explanation:</strong></p>\n\n<ul>\n<li><p>it iterates through every line from the output of the following command: </p>\n\n<pre><code>netstat -aon | findstr 9000\n</code></pre></li>\n<li><p>from every line, the PID (<code>%a</code> - the name is not important here) is extracted (PID is the <code>5</code><sup>th</sup> element in that line) and passed to the following command</p>\n\n<pre><code>tasklist /FI "PID eq 5312"\n</code></pre></li>\n</ul>\n\n<hr>\n\n<p>If you want to <strong>skip</strong> the <strong>header</strong> and the return of the <strong>command prompt</strong>, you can use:</p>\n\n<pre><code>echo off &amp; (for /f "tokens=5" %a in (\'netstat -aon ^| findstr 9000\') do tasklist /NH /FI "PID eq %a") &amp; echo on\n</code></pre>\n\n<p><strong>Output:</strong></p>\n\n<pre><code>java.exe                      5312 Services                   0    130,768 K\n</code></pre>\n'}, {'answer_id': 37519085, 'author': 'Nishat Lakhani', 'author_id': 5715899, 'author_profile': 'https://Stackoverflow.com/users/5715899', 'pm_score': 5, 'selected': False, 'text': "<p>It is very simple to get the port number from a PID in Windows.</p>\n\n<p>The following are the steps:</p>\n\n<ol>\n<li><p>Go to run &rarr; type cmd &rarr; press <kbd>Enter</kbd>.</p></li>\n<li><p>Write the following command...</p>\n\n<pre><code>netstat -aon | findstr [port number]\n</code></pre>\n\n<p>(Note: Don't include square brackets.)</p></li>\n<li><p>Press <kbd>Enter</kbd>...</p></li>\n<li><p>Then cmd will give you the detail of the service running on that port along with the PID.</p></li>\n<li><p>Open Task Manager and hit the service tab and match the PID with that of the cmd, and that's it.</p></li>\n</ol>\n"}, {'answer_id': 39146858, 'author': 'mikemaccana', 'author_id': 123671, 'author_profile': 'https://Stackoverflow.com/users/123671', 'pm_score': 3, 'selected': False, 'text': '<h2>Using Windows\' default shell (PowerShell) and without external applications</h2>\n<p>For those using PowerShell, try <a href="https://gallery.technet.microsoft.com/scriptcenter/Get-NetworkStatistics-66057d71" rel="nofollow noreferrer"><code>Get-NetworkStatistics</code></a>:</p>\n<pre><code>&gt; Get-NetworkStatistics | where Localport -eq 8000\n\n\nComputerName  : DESKTOP-JL59SC6\nProtocol      : TCP\nLocalAddress  : 0.0.0.0\nLocalPort     : 8000\nRemoteAddress : 0.0.0.0\nRemotePort    : 0\nState         : LISTENING\nProcessName   : node\nPID           : 11552\n</code></pre>\n'}, {'answer_id': 40388051, 'author': 'bahrep', 'author_id': 761095, 'author_profile': 'https://Stackoverflow.com/users/761095', 'pm_score': 5, 'selected': False, 'text': '<p>With PowerShell 5 on Windows 10 or Windows Server 2016, run <a href="https://learn.microsoft.com/en-us/powershell/module/nettcpip/get-nettcpconnection?view=win10-ps" rel="noreferrer"><code>Get-NetTCPConnection</code></a> cmdlet. I guess that it should also work on older Windows versions.</p>\n<p>The default output of <code>Get-NetTCPConnection</code> does not include Process ID for some reason and it is a bit confusing. However, you could always get it by formatting the output. The property you are looking for is <code>OwningProcess</code>.</p>\n<ul>\n<li><p>If you want to find out the ID of the process that is listening on port 443, run this command:</p>\n<pre><code>  PS C:\\&gt; Get-NetTCPConnection -LocalPort 443 | Format-List\n\n  LocalAddress   : ::\n  LocalPort      : 443\n  RemoteAddress  : ::\n  RemotePort     : 0\n  State          : Listen\n  AppliedSetting :\n  OwningProcess  : 4572\n  CreationTime   : 02.11.2016 21:55:43\n  OffloadState   : InHost\n</code></pre>\n</li>\n<li><p>Format the output to a table with the properties you look for:</p>\n<pre><code>  PS C:\\&gt; Get-NetTCPConnection -LocalPort 443 | Format-Table -Property LocalAddress, LocalPort, State, OwningProcess\n\n  LocalAddress LocalPort  State OwningProcess\n  ------------ ---------  ----- -------------\n  ::                 443 Listen          4572\n  0.0.0.0            443 Listen          4572\n</code></pre>\n</li>\n<li><p>If you want to find out a name of the process, run this command:</p>\n<pre><code>  PS C:\\&gt; Get-Process -Id (Get-NetTCPConnection -LocalPort 443).OwningProcess\n\n  Handles  NPM(K)    PM(K)      WS(K)     CPU(s)     Id  SI ProcessName\n  -------  ------    -----      -----     ------     --  -- -----------\n  143      15     3448      11024              4572   0 VisualSVNServer\n</code></pre>\n</li>\n</ul>\n'}, {'answer_id': 40745929, 'author': 'Technotronic', 'author_id': 3013005, 'author_profile': 'https://Stackoverflow.com/users/3013005', 'pm_score': 4, 'selected': False, 'text': '<p>Type in the command: <code>netstat -aon | findstr :DESIRED_PORT_NUMBER</code></p>\n\n<p>For example, if I want to find port 80: <code>netstat -aon | findstr :80</code></p>\n\n<p>This answer was originally posted to <a href="https://stackoverflow.com/questions/1960750/how-do-i-find-which-program-is-using-port-80-in-windows">this question</a>.</p>\n'}, {'answer_id': 41839069, 'author': 'Zoomzoom', 'author_id': 1371217, 'author_profile': 'https://Stackoverflow.com/users/1371217', 'pm_score': 2, 'selected': False, 'text': '<p>For Windows, if you want to find stuff listening or connected to port 1234, execute the following at the cmd prompt: </p>\n\n<pre><code>netstat -na | find "1234"\n</code></pre>\n'}, {'answer_id': 41841264, 'author': 'Tajveer Singh Nijjar', 'author_id': 2243541, 'author_profile': 'https://Stackoverflow.com/users/2243541', 'pm_score': 4, 'selected': False, 'text': '<p>Just open a command shell and type (saying your port is 123456):</p>\n\n<pre><code>netstat -a -n -o | find "123456"\n</code></pre>\n\n<p>You will see everything you need.</p>\n\n<p>The headers are:</p>\n\n<pre><code> Proto  Local Address          Foreign Address        State           PID\n TCP    0.0.0.0:37             0.0.0.0:0              LISTENING       1111\n</code></pre>\n\n<p>This is as mentioned <a href="https://stackoverflow.com/questions/15952663/find-pid-of-process-that-use-a-port-on-windows">here</a>.</p>\n'}, {'answer_id': 48004597, 'author': 'Jpsy', 'author_id': 430742, 'author_profile': 'https://Stackoverflow.com/users/430742', 'pm_score': 3, 'selected': False, 'text': '<p><strong>Using PowerShell...</strong>\n...this would be your friend (replace 8080 with your port number):</p>\n\n<pre><code> netstat -abno | Select-String -Context 0,1 -Pattern 8080\n</code></pre>\n\n<p><strong>Sample output</strong></p>\n\n<pre><code>&gt;   TCP    0.0.0.0:8080           0.0.0.0:0              LISTENING         2920\n   [tnslsnr.exe]\n&gt;   TCP    [::]:8080              [::]:0                 LISTENING         2920\n   [tnslsnr.exe]\n</code></pre>\n\n<p>So in this example tnslsnr.exe (OracleXE database) is listening on port 8080.</p>\n\n<p><strong>Quick explanation</strong></p>\n\n<ul>\n<li><code>Select-String</code> is used to filter the lengthy output of <code>netstat</code> for the relevant lines.</li>\n<li><code>-Pattern</code> tests each line against a regular expression.</li>\n<li><code>-Context 0,1</code> will output 0 leading lines and 1 trailing line for each pattern match.</li>\n</ul>\n'}, {'answer_id': 48414545, 'author': 'Ram Sharma', 'author_id': 9137647, 'author_profile': 'https://Stackoverflow.com/users/9137647', 'pm_score': 8, 'selected': False, 'text': '<p>The -b switch mentioned in most answers requires you to have administrative privileges on the machine. You don\'t really need elevated rights to get the process name!</p>\n\n<p><strong>Find the pid of the process running in the port number (e.g., 8080)</strong></p>\n\n<pre><code>netstat -ano | findStr "8080"\n</code></pre>\n\n<p><strong>Find the process name by pid</strong></p>\n\n<pre><code>tasklist /fi "pid eq 2216"\n</code></pre>\n\n<p><a href="https://i.stack.imgur.com/m16hz.png" rel="noreferrer"><img src="https://i.stack.imgur.com/m16hz.png" alt="find process by TCP/IP port"></a></p>\n'}, {'answer_id': 50180952, 'author': 'deshapriya debesh', 'author_id': 4257636, 'author_profile': 'https://Stackoverflow.com/users/4257636', 'pm_score': 2, 'selected': False, 'text': '<p>Use the below batch script which takes a process name as an argument and gives <code>netstat</code> output for the process.</p>\n\n<pre><code>@echo off\nset procName=%1\nfor /f "tokens=2 delims=," %%F in (\'tasklist /nh /fi "imagename eq %1" /fo csv\') do call :Foo %%~F\ngoto End\n\n:Foo\nset z=%1\necho netstat for : "%procName%" which had pid "%1"\necho ----------------------------------------------------------------------\n\nnetstat -ano |findstr %z%\ngoto :eof\n\n:End\n</code></pre>\n'}, {'answer_id': 52463164, 'author': 'Blue Clouds', 'author_id': 1501191, 'author_profile': 'https://Stackoverflow.com/users/1501191', 'pm_score': 4, 'selected': False, 'text': '<p>Netstat:</p>\n\n<ul>\n<li>-a displays all connection and listening ports</li>\n<li>-b displays executables</li>\n<li>-n stop resolve hostnames (numerical form)</li>\n<li><p>-o owning process</p>\n\n<pre><code>netstat -bano | findstr "7002"\n\nnetstat -ano &gt; ano.txt \n</code></pre></li>\n</ul>\n\n<p>The <a href="https://www.nirsoft.net/utils/cports.html" rel="noreferrer">Currports</a> tool helps to search and filter</p>\n'}, {'answer_id': 53159954, 'author': 'Michael Chourdakis', 'author_id': 451321, 'author_profile': 'https://Stackoverflow.com/users/451321', 'pm_score': 3, 'selected': False, 'text': '<p>Programmatically, you need stuff from <a href="https://learn.microsoft.com/el-gr/windows/desktop/api/iphlpapi/" rel="noreferrer">iphlpapi.h</a>, for example <a href="https://learn.microsoft.com/el-gr/windows/desktop/api/iphlpapi/nf-iphlpapi-gettcptable2" rel="noreferrer">GetTcpTable2</a>(). Structures like <a href="https://learn.microsoft.com/el-gr/windows/desktop/api/tcpmib/ns-tcpmib-_mib_tcp6row2" rel="noreferrer">MIB_TCP6ROW2</a> contain the owner PID.</p>\n'}, {'answer_id': 53774815, 'author': 'Talha Imam', 'author_id': 5863938, 'author_profile': 'https://Stackoverflow.com/users/5863938', 'pm_score': 5, 'selected': False, 'text': '<p>To find out which specific process (PID) is using which port:</p>\n\n<pre><code>netstat -anon | findstr 1234\n</code></pre>\n\n<p>Where 1234 is the PID of your process. [Go to Task Manager &rarr; Services/Processes tab to find out the PID of your application.]</p>\n'}, {'answer_id': 54504013, 'author': 'Angel Venchev', 'author_id': 1571349, 'author_profile': 'https://Stackoverflow.com/users/1571349', 'pm_score': 3, 'selected': False, 'text': '<p>A single-line solution that helps me is this one. Just substitute 3000 with your port:</p>\n\n<pre><code>$P = Get-Process -Id (Get-NetTCPConnection -LocalPort 3000).OwningProcess; Stop-Process $P.Id\n</code></pre>\n\n<p>Edit: Changed <code>kill</code> to <code>Stop-Process</code> for more PowerShell-like language</p>\n'}, {'answer_id': 56059282, 'author': 'Anatole ABE', 'author_id': 2022273, 'author_profile': 'https://Stackoverflow.com/users/2022273', 'pm_score': 4, 'selected': False, 'text': '<ol>\n<li><p>Open the command prompt - start &rarr; <em>Run</em> &rarr; <code>cmd</code>, or start menu &rarr; <em>All Programs</em> &rarr; <em>Accessories</em> &rarr; <em>Command Prompt</em>.</p></li>\n<li><p>Type</p>\n\n<pre><code>netstat -aon | findstr \'[port_number]\'\n</code></pre></li>\n</ol>\n\n<p>Replace the <code>[port_number]</code> with the actual port number that you want to check and hit <kbd>Enter</kbd>.</p>\n\n<ol start="3">\n<li>If the port is being used by any application, then that application’s detail will be shown. The number, which is shown at the last column of the list, is the PID (process ID) of that application. Make note of this.</li>\n<li><p>Type</p>\n\n<pre><code>tasklist | findstr \'[PID]\'\n</code></pre></li>\n</ol>\n\n<p>Replace the <code>[PID]</code> with the number from the above step and hit <kbd>Enter</kbd>.</p>\n\n<ol start="5">\n<li>You’ll be shown the application name that is using your port number.</li>\n</ol>\n'}, {'answer_id': 58009506, 'author': 'lczapski', 'author_id': 11733759, 'author_profile': 'https://Stackoverflow.com/users/11733759', 'pm_score': 2, 'selected': False, 'text': '<p>Based on answers with <a href="https://stackoverflow.com/questions/48198/how-can-you-find-out-which-process-is-listening-on-a-port-on-windows/48202#48202">info</a> and <a href="https://stackoverflow.com/questions/48198/how-can-you-find-out-which-process-is-listening-on-a-port-on-windows/23136177#23136177">kill</a>, for me it is useful to combine them in <a href="https://stackoverflow.com/questions/17289969/how-to-split-command-output-in-windows-command-prompt/17290706#17290706">one command</a>. And you can run this from cmd to get information about process that listen on given port (example 8080):</p>\n<pre><code>for /f &quot;tokens=3 delims=LISTENING&quot; %i  in (\'netstat -ano ^| findStr &quot;8080&quot; ^| findStr &quot;[&quot;\') do @tasklist /nh /fi &quot;pid eq %i&quot;\n</code></pre>\n<p>Or if you want to kill it:</p>\n<pre><code>for /f &quot;tokens=3 delims=LISTENING&quot; %i  in (\'netstat -ano ^| findStr &quot;8080&quot; ^| findStr &quot;[&quot;\') do @Taskkill /F /IM %i\n</code></pre>\n<p>You can also put those command into a bat file (they will be slightly different - replace <code>%i</code> for <code>%%i</code>):</p>\n<h3>File <code>portInfo.bat</code></h3>\n<pre><code>for /f &quot;tokens=3 delims=LISTENING&quot; %%i  in (\n    \'netstat -ano ^| findStr &quot;%1&quot; ^| findStr &quot;[&quot;\'\n) do @tasklist /nh /fi &quot;pid eq %%i&quot;\n</code></pre>\n<h3>File <code>portKill.bat</code></h3>\n<pre><code>for /f &quot;tokens=3 delims=LISTENING&quot; %%i  in (\n    \'netstat -ano ^| findStr &quot;%1&quot; ^| findStr &quot;[&quot;\'\n) do @Taskkill /F /IM %%i\n</code></pre>\n<p>Then you from cmd you can do this:</p>\n<p><code>portInfo.bat 8080</code></p>\n<p>or</p>\n<p><code>portKill.bat 8080</code></p>\n'}, {'answer_id': 62889072, 'author': 'jiz', 'author_id': 4894302, 'author_profile': 'https://Stackoverflow.com/users/4894302', 'pm_score': 3, 'selected': False, 'text': "<p>To find pid who using port 8000</p>\n<pre><code>netstat -aon | findstr '8000'\n</code></pre>\n<p>To Kill that Process in windows</p>\n<pre><code>taskkill /pid pid /f\n</code></pre>\n<p>where pid is the process id which you get form first command</p>\n"}, {'answer_id': 63375462, 'author': 'Benjamin Wen', 'author_id': 5492956, 'author_profile': 'https://Stackoverflow.com/users/5492956', 'pm_score': 4, 'selected': False, 'text': '<p>In case someone need an equivalent for macOS like I did, here is it:</p>\n<p><code>lsof -i tcp:8080</code></p>\n<p>After you get the <code>PID</code> of the process, you can kill it with:</p>\n<p><code>kill -9 &lt;PID&gt;</code></p>\n'}, {'answer_id': 64988942, 'author': 'Daniel Genezini', 'author_id': 4058784, 'author_profile': 'https://Stackoverflow.com/users/4058784', 'pm_score': 3, 'selected': False, 'text': '<p>You can also check the reserved ports with the command below. <a href="https://en.wikipedia.org/wiki/Hyper-V" rel="nofollow noreferrer">Hyper-V</a> reserve some ports, for instance.</p>\n<pre><code>netsh int ipv4 show excludedportrange protocol=tcp\n</code></pre>\n'}, {'answer_id': 66233917, 'author': 'David Jesus', 'author_id': 5869384, 'author_profile': 'https://Stackoverflow.com/users/5869384', 'pm_score': 5, 'selected': False, 'text': '<p><code>netstat -aof | findstr :8080</code> (Change 8080 for any port)</p>\n'}, {'answer_id': 71288879, 'author': 'Oliver Gaida', 'author_id': 11000412, 'author_profile': 'https://Stackoverflow.com/users/11000412', 'pm_score': 3, 'selected': False, 'text': '<h2>PowerShell</h2>\n<p>If you want to have a good overview, you can use this:</p>\n<pre><code>Get-NetTCPConnection -State Listen | Select-Object -Property *, `\n    @{\'Name\' = \'ProcessName\';\'Expression\'={(Get-Process -Id $_.OwningProcess).Name}} `\n    | select ProcessName,LocalAddress,LocalPort\n</code></pre>\n<p>Then you get a table like this:</p>\n<pre><code>ProcessName              LocalAddress  LocalPort\n-----------              ------------  ---------\nservices                 ::                49755\njhi_service              ::1               49673\nsvchost                  ::                  135\nservices                 0.0.0.0           49755\nspoolsv                  0.0.0.0           49672\n</code></pre>\n<p>For <a href="https://en.wikipedia.org/wiki/User_Datagram_Protocol" rel="nofollow noreferrer">UDP</a>, it is:</p>\n<pre><code>Get-NetUDPEndpoint | Select-Object -Property *, `\n   @{\'Name\' = \'ProcessName\';\'Expression\'={(Get-Process -Id $_.OwningProcess).Name}} `\n   | select ProcessName,LocalAddress,LocalPort\n</code></pre>\n'}]
['https://Stackoverflow.com/questions/48198', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/4883/']