PowerShell the way to output special symbols in the console _powershell

Source: Internet
Author: User

Did you know that the PowerShell console can also output a special icon? All you have to do is set the console font to be a TrueType font, such as "Consolas".

To display special characters, use either decimal or hexadecimal character codes, such as:

[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:

function prompt
{
 
$specialChar 1 = [char]0x25ba
 
write-host ' PS '-nonewline
write-host $specialChar 1- Foregroundcolor green-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 message, which is understandable, otherwise who knows if the last command was executed? This is why the above function uses a space as the return value, and the write-host to suppress the symbols that need to be displayed.

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.