This article mainly introduced the PowerShell in the console output special symbol method, this article has given the realization code and the output legend, this article code output a green triangle, needs the friend to be possible to refer to under
Did you know that the PowerShell console can also output special icons? All you have to do is set up the console font as a TrueType font, such as "Consolas".
To display special characters, use either decimal or hexadecimal character codes, such as:
?
1 2 |
[char]8730 [Char]0x25ba |
or open the built-in application "Charactermap" on the system to select a symbol that you want to display on the console. The following example is the way to make the PowerShell console tip information more bizarre:
or open the built-in application "Charactermap" on the system to select a symbol that you want to display on the console. The following example is the way to make the PowerShell console tip information more bizarre:
?
1 2 3 4 5 6 7 8 9 10 11 |
function prompt {$specialChar 1 = [char]0x25ba write-host ' PS '-nonewline write-host $specialChar 1-foregroundcolor G Reen-nonewline ' $host. Ui. Rawui.windowtitle = get-location} |
Take the picture as the proof:
Note that the "prompts" function must return at least one character, otherwise the PowerShell console will print out the default prompts, which is understandable, otherwise who knows if the last command has been executed? This is why the above function uses a space as the return value, And through the write-host to suppress the need to display symbols.