Skip to content

Latest commit

 

History

History

v5-Output-before-Read-Host

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 

v5 output before Read-Host

In PowerShell v5 output written by some commands preceding Read-Host may be not shown until Read-Host completes. The same is true for the function pause which uses Read-Host.

Example (Test-1.issue.ps1):

Get-Process | Select-Object Name, WS
Read-Host Pause

In v5 Read-Host prompt Pause is shown first.

Test-2.workaround.ps1 shows a workaround. Use Out-Host to make the output shown before Read-Host:

Get-Process | Select-Object Name, WS | Out-Host
Read-Host Pause

Other commands dealing with output may help, too: Out-String, Format-Table.