Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
PS: colorize command output
.\CompilerSim.exe | foreach-object -process {
switch ($_){
{ $_.tolower().contains("warning")} {Write-Host $_ -foregroundColor Yellow}
{ $_.tolower().contains("error")} {Write-Host $_ -foregroundColor Red}
default {Write-Host $_ -foregroundColor White}
}
}
#Ref: https://stackoverflow.com/a/9530314/2747089
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment