locked
force output separately RRS feed

  • Question

  • hi!

    when you output PowerShell objects, it checks the type. if the type is the same - it will 'glue' entire output to a single table. in some cases it's not expected bahaviour which makes debugging uneasy. is there a way to force PS to show the separately?

    e.g. [it's silly but it's only to show the meaning,true example has much more sense (; ]:

    Get-Process|%{ Write-Host "CHECKING $($_.name)"; $_}

    it will show single header raw and show all as single table, including write-host. i need to find a way to split it to show all object as a separate table.


    -o((: Leliv

    Thursday, July 21, 2016 11:50 AM

Answers

  • Get-Process|%{ Write-Host "CHECKING $($_.name)" -fore green ; $_|ft}

    I think you misunderstand how PowerShell works with output.  It works exactly how we need it to work.

    What you are trying to do seems a bit strange.


    \_(ツ)_/

    • Marked as answer by Lelivienne Thursday, July 21, 2016 1:39 PM
    Thursday, July 21, 2016 1:27 PM

All replies

  • Get-Process|%{ Write-Host "CHECKING $($_.name)" -fore green ; $_|ft}

    I think you misunderstand how PowerShell works with output.  It works exactly how we need it to work.

    What you are trying to do seems a bit strange.


    \_(ツ)_/

    • Marked as answer by Lelivienne Thursday, July 21, 2016 1:39 PM
    Thursday, July 21, 2016 1:27 PM
  • actually i'm quite proficient in PS

    format-table behaviour is exaclty what i need.

    thx


    -o((: Leliv

    Thursday, July 21, 2016 1:39 PM
  • actually i'm quite proficient in PS

    format-table behaviour is exaclty what i need.

    thx


    -o((: Leliv


    Still the output from Write-Host will never be output to anywhere.  That is how it works.

    \_(ツ)_/

    Thursday, July 21, 2016 1:41 PM