3

Netstat output breaks line when -aonb options are used. I can't use FIND to filter the output in one line.

Increasing Screen buffer width and Window width doesn't help. The command still breaks into new lines. Its the same with powershell.

    netstat -aonb
    Active Connections

      Proto  Local Address          Foreign Address        State           PID
      TCP    0.0.0.0:135            0.0.0.0:0              LISTENING       1304
      RpcSs
     [svchost.exe]
      TCP    0.0.0.0:27036          0.0.0.0:0              LISTENING       11096
     [Steam.exe]
      TCP    0.0.0.0:49665          0.0.0.0:0              LISTENING       1680
      Schedule
     [svchost.exe]
      TCP    0.0.0.0:49666          0.0.0.0:0              LISTENING       1632
      EventLog
     [svchost.exe]

I want to use FIND command to filter the ports used by process, but since it break lines, I could not filter it.

    netstat -aonb | FIND "svchost.exe"
    [svchost.exe]
1
  • Just ran into this multiline output for a single port (up to three lines!) and don't believe it. FIND not useful in this case as you say. The guy in MS responsible for this should be fired...
    – Pontiac_CZ
    Commented Dec 19, 2022 at 8:41

1 Answer 1

0

If you are happy to switch to PowerShell, a solution can be found or adapted from the post :

Powershell one-liner to show process on same line as port using netstat issue

2
  • 4
    Answer? or comment?
    – Biswapriyo
    Commented May 15, 2018 at 8:34
  • @Biswapriyo: Maybe both - it does answer the question, and especially if the poster accepts it (in that case the post becomes duplicate of my link).
    – harrymc
    Commented May 15, 2018 at 8:37

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .