0

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]
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

  • 3
    Answer? or comment? – Biswapriyo May 15 '18 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 May 15 '18 at 8:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.