Reputation: 40499
In PowerShell's documentation, I have come across the expression expandable string:
Argument mode is designed for parsing arguments and parameters for commands in a shell environment. All input is treated as an expandable string unless it uses one of the following syntaxes:
Unfortunately, I am unable to find a definition for expandable string and my question is: what is an expandable string in PowerShell?
Upvotes: 3
Views: 1017
Reputation: 437177
It is definitely unfortunate that, as of this writing, the official help topic on PowerShell string literals, about_Quoting_Rules doesn't introduce the term expandable string [update: the online version now does; to also see the update locally, you may have to run Update-Help
].
An expandable string is:
A double-quoted string literal ("..."
)
'...'
) is a verbatim (literal) string.@"<newline>...<newline>"@
), see the bottom section of this answer.Double-quoted strings perform string interpolation (expansion).
"$var"
), and expressions and whole statements via $()
(e.g., "$($var.property)"
). Escape verbatim $
(and "
) chars. with `
. Enclose variable names in {...}
for disambiguation (e.g. "${var}"
).Upvotes: 6