在前面的PowerShell技巧中,我们看到了PowerShell控制台支持输出所有TrueType字体的字符,你只需将你的字符代码转换成Char类型。今天再来一个更高级的例子,让用户在控制台中插入绿色的打勾符号。
$greenCheck = @{
Object = [Char]8730
ForegroundColor = 'Green'
NoNewLine = $true
}
Write-Host "Status check... " -NoNewline
Start-Sleep -Seconds 1
Write-Host @greenCheck
Write-Host " (Done)"