UPDATE: PSVersion 5.1.19041.610
I'm trying to do what I thought was quite simple: save a file list (including some meta-info) in a text file.
Get-ChildItem | Out-File test.txt
This should do the trick, right?
Unfortunately, every filename that's too long gets wrapped, like following.
Directory: C:\temp\test_file_names
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a---- 03.02.2021 13:16 8 some_very_very_very_very_very_very_very_long_f
ile_name.file
Using the -Width
parameter of Out-File
removes the wrapping.
Get-ChildItem | Out-File -Width 300 test.txt
But now every line is padded with spaces to be exactly 300 wide.
Changing $Host.UI.RawUI.BufferSize
has the same effect.
Is it possible to somehow get no wrapping and no padding?