Resolve Environmental Variable Not Expanding in PowerShell Script on Windows - DevPops-Inc/windows GitHub Wiki
• The following resolution is for if an environment variable won’t expand in a PowerShell script.
•
• Open the PowerShell script in your desired code editor then go to before you return the variable that contains the environment variable and press the Enter key to create a new space.
•
• Type $< variable > = $ExecutionContext.InvokeCommand.ExpandString($< variable >)
to expand the environment variable and save the value in a variable.
•
• Run the PowerShell script again.
•
• The environment variable will expand this time around.
•