1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 |
$ColorMainWindowTitle = @{ Name = "MainWindowTitle" Expression = { switch ($_.MainWindowTitle) { default { $color = "255;0;255" } # Color magenta por defecto } $esc = [char]27 "$esc[38;2;${color}m$($_.MainWindowTitle)${esc}[0m" } } # Obtiene los procesos con ventana y los filtra por los que tienen un título Get-Process | Where-Object {$_.MainWindowTitle -and $_.ProcessName -eq "chrome"} | Select-Object ProcessName, $ColorMainWindowTitle |