Quantcast
Channel: Using expanding strings as Powershell function parameters - Stack Overflow
Browsing all 3 articles
Browse latest View live

Answer by Mark Wragg for Using expanding strings as Powershell function...

Your issue occurs because the $Name string replacement is happening outside of the function, before the $Name variable is populated inside of the function.You could do something like this...

View Article



Answer by mklement0 for Using expanding strings as Powershell function...

In order to delay string interpolation and perform it on demand, with then-current values, you must use $ExecutionContext.InvokeCommand.ExpandString()[1] on a single-quoted string that acts as a...

View Article

Using expanding strings as Powershell function parameters

I'm trying to write a function that will print a user-supplied greeting addressed to a user-supplied name. I want to use expanding strings the way I can in this code block: $Name = "World"$Greeting =...

View Article
Browsing all 3 articles
Browse latest View live




Latest Images