Powershell-quotes and escape characters

Source: Internet
Author: User

    • Powershell quotes and escape characters


Single quotation marks: In all cases, only the characters within the quotation marks are represented.

Output:

$a = "World" <enter>

' Hello, $a '

results : Hello, $a

  1. < Span style= "Color:rgb (85,85,85); font-family: ' The song Body '; > double quotes: variable substitution and character escaping are allowed.

    output:

    " hello,  $a "

    result: hello, world

    &NBSP;

  2. ,

    ' I ' m $a '

    result : i ' m   $a

     

    $a = "123"

    result : "i ' m  123 "

    &NBSP;

  3. Escape character use

    Anti-Quote ` definition, you should use "' t" to invoke

    The commonly used escape strings are:

    "' single quotation marks

    ' " Double quotes

    ' 0 Vacant NULL

    ' a Alarm

    ' B BACKSPACE

    ' F Skip Page

    ' n New Line

    ' r line Break

    ' t Horizontal Tab Key

    ' v the public Tab Key

    psc:\users\administrator> "' r" ' $a, the output $a, function to remove this variable substitution

    For example:

    $a = "PowerShell" <enter>

    "" "" Myname is ' $a "", the This program said. "<enter>

    The output will be:

    "Myname is $a", this program said.

Reference: http://marui.blog.51cto.com/1034148/300603


This article comes from the "Ricky's blog" blog, please be sure to keep this source http://57388.blog.51cto.com/47388/1639490

Powershell-quotation marks and escape characters

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.