locked
How could I display the result of Export-csv to console ? RRS feed

  • Question

  • I would like to display the result of Export-csv to Powershell console .

    How could I do that ?

    • Moved by Script Explorer Administration Thursday, September 6, 2012 5:36 PM Not specific to Script Explorer (From:Script Explorer for Windows PowerShell)
    Thursday, September 6, 2012 10:45 AM

Answers

  • I couldn't get 'tee-object' to play nice with export-csv, so my workaround is variable + write-host + then export-csv.   Three lines, meh.

    $PROCS = Get-Process 
    Write-Host $PROCS
    $PROCS | Export-CSV d:\procs.csv

    Don't forget to mark your posts as answered so they drop off the unanswered post filter. If I've helped you and you want to show your gratitude, just click that green thingy.


    • Edited by Knuckle-Dragger Friday, September 7, 2012 10:26 AM
    • Marked as answer by Yan Li_ Friday, September 14, 2012 3:03 AM
    Friday, September 7, 2012 10:25 AM
  • Hi,

    To display the result without outputting to file?

    write-host, and then save the result in csv.

    I have to say that it should work the same as save it and then display the file on the powershell console.

    Regards,

    Yan Li


    Yan Li

    TechNet Community Support

    • Marked as answer by Yan Li_ Friday, September 14, 2012 3:03 AM
    Monday, September 10, 2012 8:14 AM

All replies

  • Executing import-csv 'mycsv.csv' will display the contents in the console.

    ...or... "type 'mycsv.csv'" to see what's inside the file.

    Just a humble SysAdmin


    • Edited by RiffyRiot Friday, September 7, 2012 3:32 AM
    • Proposed as answer by Kazun Friday, September 7, 2012 10:05 AM
    Thursday, September 6, 2012 6:40 PM
  • Thank you.

    I would like to do that without outputting to file if possible.

    Use ConvertTo-CSV cmdlet.

    Get-ChildItem C:\Windows | Select Name,LastAccessTime | ConvertTo-CSV -NoType

    Friday, September 7, 2012 10:04 AM
  • I couldn't get 'tee-object' to play nice with export-csv, so my workaround is variable + write-host + then export-csv.   Three lines, meh.

    $PROCS = Get-Process 
    Write-Host $PROCS
    $PROCS | Export-CSV d:\procs.csv

    Don't forget to mark your posts as answered so they drop off the unanswered post filter. If I've helped you and you want to show your gratitude, just click that green thingy.


    • Edited by Knuckle-Dragger Friday, September 7, 2012 10:26 AM
    • Marked as answer by Yan Li_ Friday, September 14, 2012 3:03 AM
    Friday, September 7, 2012 10:25 AM
  • Hi,

    To display the result without outputting to file?

    write-host, and then save the result in csv.

    I have to say that it should work the same as save it and then display the file on the powershell console.

    Regards,

    Yan Li


    Yan Li

    TechNet Community Support

    • Marked as answer by Yan Li_ Friday, September 14, 2012 3:03 AM
    Monday, September 10, 2012 8:14 AM