I want to substitute a variable to existing string, say:
$x = "Hello `$xxx friend"
$xxx = 777
similar_to_js_exec($x) # i need here "Hello 777 friend"
How can i do it ?
I want to substitute a variable to existing string, say:
$x = "Hello `$xxx friend"
$xxx = 777
similar_to_js_exec($x) # i need here "Hello 777 friend"
How can i do it ?
You need to use Invoke-Expression
$x = '"Hello $xxx friend"'
$xxx = 777
Invoke-Expression $x