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 = "Hello, $Name!" $Greeting Which successfully prints Hello, World! . However, when I try to pass these strings as parameters to a function like so, function HelloWorld { Param ($Greeting, $Name) $Greeting } HelloWorld("Hello, $Name!", "World") I get the output Hello, ! World Upon investigation,