Created
November 19, 2017 23:50
-
-
Save ExtremeGTX/b8315163aa02e7a4b2320dbe61c8dced to your computer and use it in GitHub Desktop.
PS: colorize command output
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
.\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