I think perhaps it is something similar to write-host. Write-host goes directly to the console, which can make it show up before other write-output commands that were executed long before write-host. Take this example
When the command write-output is called, it takes a split second to calculate the output. Therefore the actual output shows up reverse of the order one might expect.
test
TypeName: Selected.System.DateTime
Name MemberType Definition
---- ---------- ----------
Equals Method bool Equals(System.Object obj)
GetHashCode Method int GetHashCode()
GetType Method type GetType()
ToString Method string ToString()
Date NoteProperty datetime Date=2020-05-26 12:00:00 AM
DateTime NoteProperty System.String DateTime=Tuesday, May 26, 2020 2:27:37 PM
Day NoteProperty int Day=26
DayOfWeek NoteProperty DayOfWeek DayOfWeek=Tuesday
DayOfYear NoteProperty int DayOfYear=147
DisplayHint NoteProperty DisplayHintType DisplayHint=DateTime
Hour NoteProperty int Hour=14
Kind NoteProperty DateTimeKind Kind=Local
Millisecond NoteProperty int Millisecond=886
Minute NoteProperty int Minute=27
Month NoteProperty int Month=5
Second NoteProperty int Second=37
Ticks NoteProperty long Ticks=637261000578866934
TimeOfDay NoteProperty timespan TimeOfDay=14:27:37.8866934
Year NoteProperty int Year=2020
As opposed to this
write-output (get-date)
write-host "test"
Tuesday, May 26, 2020 2:32:24 PM
test
If this is the case, perhaps you can assign it to a variable and then output it when you’re ready. (just remember write-host nuance)
$userinput = Read-Host -Prompt "Enter some input"
write-host $userinput
[quote quote=231169]I think perhaps it is something similar to write-host. Write-host goes directly to the console, which can make it show up before other write-output commands that were executed long before write-host. Take this example
When the command write-output is called, it takes a split second to calculate the output. Therefore the actual output shows up reverse of the order one might expect.
Yes that is exactly the problem the Read-Host is realized before my Table but when I enter any character when the Read-Host ask i Have in first what I have typing when the Read-Host asking me and in the second my table that is exactly the exemple that you give with Write-Host.
I just tried and that doesn’t work too the display is always after the read-Host
EDIT : I found a way to bypass the problem I have added another Read-Host before the first that doesn’t resolve the problem but that allow to bypass it.