variables de eco en powershell usando Write-Output

variables de eco en powershell usando Write-Output

Acabo de configurar un par de variables en Windows 10 usando el panel de control.

Variable: TWILIO_ACCOUNT_SID Valor de la variable:my_account_sid

Variable: TWILIO_AUTH_TOKEN Valor de la variable:my_twilio_auth_token

Lo hago refreshenven powershell para poder ver los nuevos valores.

Pero cuando lo hago:

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

Simplemente obtengo líneas en blanco en lugar de los valores. ¿Qué estoy haciendo mal?

Respuesta1

En Powershell puede usar la ENV:VariableNameunidad para llamar a variables de entorno.

Ejemplo:

Get-ChildItem ENV:systemroot

Name                           Value
----                           -----
SystemRoot                     C:\WINDOWS

En tu caso puedes llamarlo comoWrite-Output "ENV:TWILIO_ACCOUNT_SID"

información relacionada