How to close TCP and UDP ports via windows command line

后端 未结 17 1616
忘掉有多难
忘掉有多难 2020-12-07 06:43

Does somebody knows how to close a TCP or UDP socket for a single connection via windows command line?

Googling about this, I saw some people asking the same thing.

17条回答
  •  隐瞒了意图╮
    2020-12-07 07:38

    Use CurrPorts (it's free and no-install): http://www.nirsoft.net/utils/cports.html

    /close {Process Name}

    Examples:

    # Close all connections with remote port 80 and remote address 192.168.1.10: 
    /close * * 192.168.1.10 80
    # Close all connections with remote port 80 (for all remote addresses): 
    /close * * * 80
    # Close all connections to remote address 192.168.20.30: 
    /close * * 192.168.20.30 *
    # Close all connections with local port 80: 
    /close * 80 * *
    # Close all connections of Firefox with remote port 80: 
    /close * * * 80 firefox.exe
    

    It also has a nice GUI with search and filter features.

    Note: This answer is huntharo and JasonXA's answer and comment put together and simplified to make it easier for readers. Examples come from CurrPorts' web page.

提交回复
热议问题