You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Direct redirection of a custom object ([pscustomobject] instance) to a file with ">" produces no output. #4812
Even though > is not an actual alias of Out-File, it usually is an effective alias; the two generally behave the same.
However, when outputting a [pscustomobject] instance, > apparently produces an empty file (the file contains only the UTF16-LE BOM and a newline):
Steps to reproduce
# Use Out-File explicitly.
[pscustomobject] @{ one=1 } |Out-File tmp.txt; Get-Content tmp.txt
'---'# Use > instead of Out-File, which should produce the same result.
[pscustomobject] @{ one=1 } > tmp.txt; Get-Content tmp.txt
Expected behavior
one
---
1
---
one
---
1
Actual behavior
one
---
1
---
I.e., using > instead of Out-File resulted in an empty file (just the UTF16-LE BOM and a newline).
Environment data
PowerShell Core v6.0.0-beta.6 on macOS 10.12.6
PowerShell Core v6.0.0-beta.6 on Ubuntu 16.04.3 LTS
PowerShell Core v6.0.0-beta.6 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)
Windows PowerShell v5.1.15063.502 on Microsoft Windows 10 Pro (64-bit; v10.0.15063)
Activity
Fix bugs with expression redirected to file (#4847)
Fix bugs with expression redirected to file (PowerShell#4847)