I don't know much about Powershell but I try to learn. Can you help me to understand and solve what I want to do:
$string1=""
$complicatedString1 = "This is a complicated $string1"
$complicatedString2 = "$complicatedString1 too"
$string1 = "Test"
$complicatedString1 -> Should state now: This is a complicated Test
$complicatedString2 -> Should state now: This is a complicated Test too.
$string1 = "question"
$complicatedString1 -> Should state now: This is a complicated question
$complicatedString2 -> Should state now: This is a complicated question too.
and so on.
The idea sounds simple: I want to define strings that serve as templates, but with variable content. In this case I want to manipulate $string1 and update $complicatedstring 1 and 2 so that any change of $string1 gets reflected in those strings.
$string1 would change frequently and at the moment I have no approach how get the changed values into those strings. Basically the're just placeholders to wait for being changed.
$String1is still empty and you define another variable including$String1it will stay empty. You would need to re-assign the new variable AFTER you assigned something to$String1to reflect this change in the new variable. You might show or explain a little bit more of your use case.complicatedString1andcomplicatedString2in single quotes and than use:$ExecutionContext.InvokeCommand.ExpandString($complicatedString1)