2

If I run this command in powershell 4 on windows 10:

powershell $ENV:ProgramFiles

I get this:

C:\Program Files\

which is great!

If I do the same thing is powershell 5 on a Windows Nano Server I get something like this: http://paste.openstack.org/show/479695/

"\n******************** START Argument Information ********************\r\nArgs'
 Count: 1\r\n     #0: $ENV:ProgramFiles\r\n******************** END   Argument I
nformation ********************\n\r\n\n.................... START Result  Output
 ....................\r\nResults Count: 1\r\n     #0: C:\\Program Files\r\n.....
............... END   Result  Output ....................\n\r\n\n...............
..... START Error   Output ....................\r\nErrors Count: 0\r\n..........
.......... END   Error   Output ....................\n\r\n\n....................
 START Warning Output ....................\r\nWarnings Count: 0\r\n.............
....... END   Warning Output ....................\n\r\n\n.................... ST
ART Information Output ....................\r\nInformation Count: 0\r\n.........
........... END   Information Output ....................\n\r\n\n...............
..... START Verbose Output ....................\r\nVerbose Count: 0\r\n.........
........... END   Verbose Output ....................\n\r\n"

What can I do to get just the stdout of the command?

JPBlanc
  • 70,406
  • 17
  • 130
  • 175
Ionut Hulub
  • 6,180
  • 5
  • 26
  • 55
  • I'm installing Windows Server 2016, I wanna play too ! Waiting for my RPi2 to test W10 IoT too. I'll try to help as soon as I'm running nano. – sodawillow Nov 23 '15 at 11:19

1 Answers1

1

Do you need to run a new PowerShell process? If you run the command directly (in a PSSession) it works as expected (nan01 is my vanilla Nano server):

ps:\> Enter-PSSession nan01 -Credential (Get-Credential)
[nan01]: PS C:\Users\Administrator\Documents> $env:ProgramFiles
C:\Program Files

I get similar long string output as you when creating a new process as per your example. My guess is that it's a representation of the state of the spawned Powershell process, emitted before it terminates.

BTW It's PowerShell 5 on Windows 10 too.

ConanW
  • 486
  • 3
  • 7