2

I've been setup my variables for my development environment using the Windows cmd, but it works well only the first time I set them with the System>Advanced>Env Vars dialog. I just restart cmd and it works.

But after I restart the computer, it behaves quite weird. Like I have to restart cmd an indeterminate number of times for it to get the variables I set. Sometimes it even shows in the cmd when I issue the command SET, but it doesn't work if I issue a command from one of those paths. This is how it looks:

C:\Users\Adrian>set
ALLUSERSPROFILE=C:\ProgramData
ANDROID_HOME=F:\Programas\android-sdk
ANDROID_SDK_HOME=F:\Programas\android-sdk
ANT_HOME=F:\Programas\ant
APPDATA=C:\Users\Adrian\AppData\Roaming
BIN_DIR=F:\Programas\bin
CommonProgramFiles=C:\Program Files\Common Files
CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files
CommonProgramW6432=C:\Program Files\Common Files
COMPUTERNAME=SAKURA
ComSpec=C:\WINDOWS\system32\cmd.exe
configsetroot=C:\WINDOWS\ConfigSetRoot
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Users\Adrian
JAVA_HOME=C:\Program Files\Java\jdk1.7.0_60
JAVA_SDK_HOME=C:\Program Files\Java\jdk1.7.0_60
LOCALAPPDATA=C:\Users\Adrian\AppData\Local
LOGONSERVER=\\SAKURA
MAVEN_HOME=F:\Programas\maven\
MOZ_PLUGIN_PATH=C:\PROGRAM FILES (X86)\FOXIT SOFTWARE\FOXIT READER\plugins\
NUMBER_OF_PROCESSORS=8
OS=Windows_NT
Path=C:\Program Files (x86)\NVIDIA Corporation\PhysX\Common;C:\Program Files (x8
6)\Intel\iCLS Client\;C:\Program Files\Intel\iCLS Client\;C:\WINDOWS\system32;C:
\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:
\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\
Intel\Intel(R) Management Engine Components\IPT;C:\Program Files (x86)\Intel\Int
el(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Man
agement Engine Components\IPT;C:\Program Files\Lenovo\Bluetooth Software\;C:\Pro
gram Files\Lenovo\Bluetooth Software\syswow64;C:\Program Files\nodejs\;%ANDROID_
HOME%\tools;%ANDROID_HOME%\platform-tools;%JAVA_HOME%\bin;F:\Programas\ant\bin;C
:\Program Files (x86)\Git\cmd;C:\Program Files\Microsoft SQL Server\110\Tools\Bi
nn\;C:\Program Files (x86)\sbt\bin;F:\Programas\bin;%MAVEN_HOME%\bin;C:\Users\Ad
rian\AppData\Roaming\npm
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC
PROCESSOR_ARCHITECTURE=AMD64
PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 60 Stepping 3, GenuineIntel
PROCESSOR_LEVEL=6
PROCESSOR_REVISION=3c03
ProgramData=C:\ProgramData
ProgramFiles=C:\Program Files
ProgramFiles(x86)=C:\Program Files (x86)
ProgramW6432=C:\Program Files
PROMPT=$P$G
PSModulePath=C:\WINDOWS\system32\WindowsPowerShell\v1.0\Modules\
PUBLIC=C:\Users\Public
SBT_HOME=C:\Program Files (x86)\sbt\
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\Users\Adrian\AppData\Local\Temp
TMP=C:\Users\Adrian\AppData\Local\Temp
USERDOMAIN=SAKURA
USERDOMAIN_ROAMINGPROFILE=SAKURA
USERNAME=Adrian
USERPROFILE=C:\Users\Adrian
VBOX_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\
VS120COMNTOOLS=C:\Program Files (x86)\Microsoft Visual Studio 12.0\Common7\Tools
\
windir=C:\WINDOWS

C:\Users\Adrian>adb
"adb" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.

C:\Users\Adrian>adb
"adb" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.

C:\Users\Adrian>javac
"javac" no se reconoce como un comando interno o externo,
programa o archivo por lotes ejecutable.

C:\Users\Adrian>

There is a var called ANDROID_SDK_HOME that was replaced by ANDROID_HOME. That first one doesn't even exist in the registry!

Registry for user vars: user vars

Registry for system vars: system vars

What could be wrong?

PD: This is on Windows 8.1 Update 1

0

The following link may be of use What are path and other environment variables and how can I set them

I note that you have javac as one of the commands you are testing which would be part of the Java SDK and while you appear to have set the following environment variable

JAVA_SDK_HOME=C:\Program Files\Java\jdk1.7.0_60

there is no %JAVA_SDK_HOME% in your path statement so the OS would possibly not find that command in your other path entries.

3
  • It's not JAVA_SDK_HOME it's JAVA_HOME the one the path is checking for. And that one is set. In fact, you won't find ANDROID_SDK_HOME nor JAVA_SDK_HOME in the registry, nor in the System>Advanced>Env Vars dialog. They don't exist! Aug 20 '14 at 11:25
  • 1
    If you type the full path to where you are expecting the command(s) to be do they execute? e.g if you expect JAVA_HOME to contain the path to the path to the javac executable can you run C:\Program Files\Java\jdk1.7.0_60\bin\javac and have it execute. If so, that validates the full path. Then try %JAVA_HOME%\bin\javac and see if that executes as expected - that will validate that the path is correct via the environment variable. Whenever I set new environment variables for applications I test via full path then the mapping via environment variable.
    – Enigman
    Aug 20 '14 at 11:36
  • Of course, they work from their paths and using the full path. Never when using the environment variables. Until cmd happens to use them again! Its like it stores some cache of it, and it doesn't update it properly for some reason I still don't know. Aug 20 '14 at 11:39
0

It seems its a known issue on multiple versions of Windows.

I've never encountered this problem before, but following what is written here: https://superuser.com/a/484101/245733 and following the VbNetMatrix comment here: https://nuxx.net/blog/2011/08/15/shell-variables-not-expanding-in-path-on-windows-7-non-administrator-command-prompt/ I've been able to workaround it.

Variables were created as REG_SZ instead of REG_EXPAND_SZ. After changing the types in regedit and triggered to update the PATH variable expansion by clicking on "Modify" for the PATH variable in the environment variable configuration dialog (System>Advanced>Env. Vars, I don't know the exact names, my OS is set to Spanish language) the cmd was able to access those commands that were on the paths referenced in the variables I set before.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.