I created test.txt
which looks like
A A A
A AAA A
Which is essentially
A[tab]A[tab]A[newline][space]A[tab]AAA[tab]A
In cmd.exe:
C:\>type test.txt
A A A
A AAA A
So, as expected.
In powershell.exe:
PS \> Get-Content test.txt
A A
A
A A
AA A
So, it prints the first A, then the tab advances to the last column of the line and prints the second A, then tab advances to the beginning of the next line and prints the third A, then newline, then the space and the fourth A, then tab advances to the end of the line and prints the first of the AAA set and then line wrapping continues the set on the next line, and then the final tab advances to the end of the line and prints the final A.
From what I can tell, the powershell.exe console only has stops at the beginning and end of the line, and is missing the tab stops that should be every 8 spaces along the line.
Interestingly, if I use Get-Content in cmd.exe the output is as expected:
C:\>powershell Get-Content test.txt
A A A
A AAA A
doskey /MACROS:ALL
returns nothing, so there are no macros set in cmd.exe. As far as I know, type
is built in to cmd.exe, so type
and powershell Get-Content
executed in cmd.exe should be doing entirely different things to produce the same output.
“A`tA” | Format-Hex also returns 41 09 41
for me. I don’t think this is a character interpretation issue.
The issue seems to be tied to the powershell.exe application itself (as Matt pointed out, both powershell.exe and cmd.exe interface with conhost.exe, so I think the problem must be before that point). I think it must be related to the display handling in powershell.exe (related to .NET maybe?). But, it’s not an issue with the local application install, because the problem follows my domain account to other systems, and doesn’t appear for a different user account on the same system.
There are subkeys for 32- and 64-bit PowerShell under HKCU\Console, but I’ve compared these to a system on a different domain (where I haven’t experienced this issue), and they have all the same subkey names, types and data values.