Is it possible to color only certain words (not complete lines) for a powershell output using format-table. For example, this script scans a folder recursively for a string and then output the result with format-table.
dir -r -i *.* | Select-String $args[0] |
format-table -Property @{label="Line #"; Expression={$_.LineNumber}; width=6},
Path, Line -wrap
It would be nice to be able to format the word we are searching for with a specific color, so that you can see exactly where it was found on the line.
You could pipe the table into
Out-String, then write the string in parts usingWrite-Hostwith the-NoNewLineswitch.Something like this: