display some lines before and after matched pattern, using pipe to powershell

C:\Users\Administrator>ping tool.eu.org

C:\Users\Administrator>ipconfig /displaydns |powershell -Command "$input |Out-String -stream |Select-String -pattern ': tool' -Context 2,4"

       tool.eu.org
       ----------------------------------------
>      Record Name . . . . . : tool.eu.org
       Record Type . . . . . : 1
       Time To Live  . . . . : 1476
       Data Length . . . . . : 4
       Section . . . . . . . : Answer

Leave a Reply

Your email address will not be published. Required fields are marked *

Time limit is exhausted. Please reload CAPTCHA.