Book Image

Learning PowerCLI for VMware VSphere

By : Robert van den Nieuwendijk
Book Image

Learning PowerCLI for VMware VSphere

By: Robert van den Nieuwendijk

Overview of this book

Table of Contents (17 chapters)
Learning PowerCLI
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Using here-strings


Until now, you have only seen single-line strings in this book. PowerShell has a so-called here-string that spans multiple lines. You use @" or @' to start the here-string and "@ or '@ to finish the here-string. The @"or @' must be at the end of a line and the "@ or '@ must be at the beginning of the line that terminates the here-string. As in single-line strings, variables and subexpressions are expanded in double-quoted here-strings and are not expanded in single-quoted here-strings.

The following command creates a here-string that spans two lines and puts the here-string in the variable $s:

PowerCLI C:\> $s = @"
>> Learning PowerCLI
>> is a lot of fun!
>> "@
>> $s
>>
Learning PowerCLI
is a lot of fun!