# exporting fixed length

**URL:** <https://forums.powershell.org/t/exporting-fixed-length/22>\
**Category:** PowerShell Help\
**Created:** [May 5, 2013, 5:35am UTC](https://forums.powershell.org/t/exporting-fixed-length/22 "2013-05-05T05:35:08Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex019/uploads/powershell/original/1X/385e4f9fe133561ad30a814262fe0e0ae6bc3ef0.png) [@system](https://forums.powershell.org/u/system)\
**Post date:** [May 5, 2013, 5:35am UTC](https://forums.powershell.org/t/exporting-fixed-length/22/1 "2013-05-05T05:35:08Z")

</div>

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

&nbsp;

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.

Conan

---

<div class="post-metadata">

**Author:** ![mjolinor](https://avatars.discourse-cdn.com/v4/letter/m/d2c977/32.png) [@mjolinor](https://forums.powershell.org/u/mjolinor)\
**Post date:** [May 5, 2013, 10:16am UTC](https://forums.powershell.org/t/exporting-fixed-length/22/2 "2013-05-05T10:16:39Z")

</div>

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

You need the Big Book of Powershell Gotchas.

[https://powershell.org/books/the-big-book-of-powershell-gotchas-free/](https://powershell.org/books/the-big-book-of-powershell-gotchas-free/)

&nbsp;

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

---

<div class="post-metadata">

**Author:** ![donj](https://sea1.discourse-cdn.com/flex019/user_avatar/forums.powershell.org/donj/32/137_2.png) [@donj](https://forums.powershell.org/u/donj)\
**Post date:** [May 6, 2013, 2:49am UTC](https://forums.powershell.org/t/exporting-fixed-length/22/3 "2013-05-06T02:49:56Z")

</div>

LOL.

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.

---

<div class="post-metadata">

**Author:** ![dotnVo](https://avatars.discourse-cdn.com/v4/letter/d/4af34b/32.png) [@dotnVo](https://forums.powershell.org/u/dotnVo)\
**Post date:** [May 16, 2024, 8:57pm UTC](https://forums.powershell.org/t/exporting-fixed-length/22/4 "2024-05-16T20:57:50Z")

</div>


