PowerShell method of outputting special symbol in console

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.