Created
September 17, 2019 13:41
-
-
Save MyITGuy/a6d1e636fe48b4f56c308d75ca88a171 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Demonstates Write-Output writing blank lines in the console | |
# This is visible with Write-Host and Write-Verbose | |
1..3 | ForEach-Object { | |
$Properties = @{ | |
Name = "Iteration" + $_ | |
} | |
$obj = New-Object -TypeName psobject -Property $Properties | |
if ($_ -eq 1) { | |
Write-Host "↓↓ [$($Properties.Name)] Write-Output writes blank line(s) for first object due to writing header row(s) ↓↓" | |
} | |
else { | |
Write-Host "↓↓ [$($Properties.Name)] No blank line(s) written ↓↓" | |
} | |
Write-Output -InputObject $obj | |
if ($_ -eq 1) { | |
Write-Host "↑↑ [$($Properties.Name)] Write-Output writes blank line(s) for first object due to writing header row(s) ↑↑" | |
} | |
else { | |
Write-Host "↑↑ [$($Properties.Name)] No blank line(s) written ↑↑" | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment