Special variable $null in PowerShell introduction and creation of multiline annotation tips _powershell

Source: Internet
Author: User

This article introduces a very special variable in PowerShell, that is $null. The special thing about $null is that it never stores content.

While looking through a book of PowerShell, I found a description of the $null variable, which was very interesting and a close-up to share with you.

Take a look at this example:

Copy Code code as follows:

PS c:\users\zhanghong> $null =1122
PS c:\users\zhanghong> $null
PS c:\users\zhanghong>

Do you understand? The small series assigns a value of "1122" to the $null variable, but when I output it immediately, I find that it has no content.

If we use $null with here string (just @), we can get multiple lines of comment. and see the effect:

Copy Code code as follows:

#正常注释
$null =@ "
Comment Content Line 1
Comment Content Line 2
Comment Content Line 3
@"
#正常注释

We can realize the magical $null variable.

OK, about PowerShell special variable $null, Hongo introduced so, hope to help everyone.

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.