exporting fixed length

Welcome Forums General PowerShell Q&A exporting fixed length

This topic contains 2 replies, has 3 voices, and was last updated by

5 years, 9 months ago.

  • Author
  • #4026

    Points: 0
    Rank: Member

    Invoke-Sqlcmd -ServerInstance  MYPC -Database salesdatabase -Query usp_GetProductList  |  Format-TABLE-autosize  |Out-File C:\TEST.TXT


    I am exporting a fixed lenght file.. Powershell is putting in a blank space between columns. I can't have that in my export file.

    Thanks in advance.


  • #4031

    Points: 0
    Rank: Member

    You're sabotaging your output with that format-table.

    You need the Big Book of Powershell Gotchas.



    Don – we need a sidebar menu with a link to that.

  • #4064

    Points: 1,811
    Helping HandTeam Member
    Rank: Community Hero


    Rob's right – Format-Table and the other Format cmdlets are intended to produce human-readable, formatted text. For a fixed-field output, you'll probably need to write a custom function to get really accurate output.

The topic ‘exporting fixed length’ is closed to new replies.

denizli escort samsun escort muğla escort ataşehir escort kuşadası escort