echo variables in powershell using Write-Output

I've just set a couple of variables in Windows 10 using the control panel.

Variable: TWILIO_ACCOUNT_SIDVariable Value: my_account_sid

Variable: TWILIO_AUTH_TOKENVariable Value: my_twilio_auth_token

I do refreshenv in powershell so I can see the new values.

But when I do:

Write-Output "$TWILIO_ACCOUNT_SID"
Write-Output "$TWILIO_ACCOUNT_SID"

I just get blank lines instead of the values. What am I doing wrong?

1 Answer

In Powershell you can use the ENV:VariableName drive to call environment variables.

Example:

Get-ChildItem ENV:systemroot
Name Value
---- -----
SystemRoot C:\WINDOWS

In your case you can call it as Write-Output "ENV:TWILIO_ACCOUNT_SID"

2

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like