Skip to main content

windows - CMD doesn't update environment variables even when restarting the OS


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



Answer



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.


Comments

Popular Posts

Use Google instead of Bing with Windows 10 search

I want to use Google Chrome and Google search instead of Bing when I search in Windows 10. Google Chrome is launched when I click on web, but it's Bing search. (My default search engine on Google and Edge is http://www.google.com ) I haven't found how to configure that. Someone can help me ? Answer There is no way to change the default in Cortana itself but you can redirect it in Chrome. You said that it opens the results in the Chrome browser but it used Bing search right? There's a Chrome extension now that will redirect Bing to Google, DuckDuckGo, or Yahoo , whichever you prefer. More information on that in the second link.

linux - Using an index to make grep faster?

I find myself grepping the same codebase over and over. While it works great, each command takes about 10 seconds, so I am thinking about ways to make it faster. So can grep use some sort of index? I understand an index probably won't help for complicated regexps, but I use mostly very simple patters. Does an indexer exist for this case? EDIT: I know about ctags and the like, but I would like to do full-text search. Answer what about cscope , does this match your shoes? Allows searching code for: all references to a symbol global definitions functions called by a function functions calling a function text string regular expression pattern a file files including a file

How do I transmit a single hexadecimal value serial data in PuTTY using an Alt code?

I am trying to sent a specific hexadecimal value across a serial COM port using PuTTY. Specifically, I want to send the hex codes 9C, B6, FC, and 8B. I have looked up the Alt codes for these and they are 156, 182, 252, and 139 respectively. However, whenever I input the Alt codes, a preceding hex value of C2 is sent before 9C, B6, and 8B so the values that are sent are C2 9C, C2 B6, and C2 8B. The value for FC is changed to C3 FC. Why are these values being placed before the hex value and why is FC being changed altogether? To me, it seems like there is a problem internally converting the Alt code to hex. Is there a way to directly input hex values without using Alt codes in PuTTY? Answer What you're seeing is just ordinary text character set conversion. As far as PuTTY is concerned, you are typing (and reading) text , not raw binary data, therefore it has to convert the text to bytes in whatever configured character set before sending it over the wire. In other words, when y

networking - Windows 10, can ping other PC but cannot access shared folders! What gives?

I have a computer running Windows 7 that shares a Git repo on drive D. Let's call this PC " win7 ". This repo is the origin of a project that we push to and pull from. The network is a wireless network. One PC on this network is running on Windows 10. Let's call this PC " win10 ". Win10 can ping every other PC on the network including win7 . Win7 can ping win10 . Win7 can access all shared files on win10 . Neither of the PCs have passwords. Problem : Win10 cannot access any shared files on win7 , not from Explorer, nor from Git Bash or any other Git management system (E-Git on Eclipse or Visual Studio). So, win10 cannot pull/push. Every other PC on the network can access win7 shared files and push/pull to/from the shared Git origin. What's wrong with Windows 10? I have tried these: Control Panel\All Control Panel Items\Network and Sharing Center\Advanced sharing settings\ File sharing is on, Discovery is on, Password protected sharing is off Adapte