Skip to content

Instantly share code, notes, and snippets.

@ExtremeGTX
Created November 19, 2017 23:50
Show Gist options
  • Save ExtremeGTX/b8315163aa02e7a4b2320dbe61c8dced to your computer and use it in GitHub Desktop.
Save ExtremeGTX/b8315163aa02e7a4b2320dbe61c8dced to your computer and use it in GitHub Desktop.
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