-
Notifications
You must be signed in to change notification settings - Fork 3
Resolve Environmental Variable Not Expanding in PowerShell Script on Windows
Vic Phan edited this page Jan 15, 2023
·
1 revision
• 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.
•
Please reach out on LinkedIn if you have any questions or suggestions.
Please reach out to Scorpion Computer Services for consultation inquiries.