Windows 10: no se puede cd $ ANDROID_HOME

Aug 16 2020

Tengo una configuración de variable de entorno de usuario:

ANDROID_HOME = C: \ Users \ steve \ AppData \ Local \ Android \ Sdk \ platform-tools

En Windows 10 Powershell, si intento: cd $ ANDROID_HOME, recibo el siguiente error:

cd : Cannot process argument because the value of argument "path" is null. Change the value of argument "path" to a
non-null value.
At line:1 char:1
+ cd $ANDROID_HOME

¿Debería ser posible un CD a una ruta de variable de entorno?

Ayuda apreciada.

Respuestas

2 DavidPostill Aug 16 2020 at 20:46

¿Debería ser posible un CD a una ruta de variable de entorno?

PowerShell maneja las variables de entorno de manera diferente a cmd.

Para mostrar sus valores en PowerShell, use la siguiente sintaxis:

$Env:variablename

Ejemplo:

> echo %Path%
%Path%
> $Env:Path
C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\apps\WSCC\Sysinternals Suite;C:\apps\WSCC\NirSoft Utilities
>

Entonces, en su caso particular, necesita el siguiente comando en Powershell:

cd $Env:ANDROID_HOME

Otras lecturas

  • Un índice AZ de comandos de Windows PowerShell : una excelente referencia para todo lo relacionado con PowerShell.
  • Variables de entorno
  • Hágase cargo de las variables de entorno en PowerShell