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

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...

linux - Extract/save a mail attachment using bash

Using normal bash tools (ie, built-ins or commonly-available command-line tools), is it possible, and how to extract/save attachments on emails? For example, say I have a nightly report which arrives via email but is a zip archive of several log files. I want to save all those zips into a backup directory. How would I accomplish that? Answer If you're aiming for portability, beware that there are several different versions of mail(1) and mailx(1) . There's a POSIX mailx command, but with very few requirements. And none of the implementations I have seem to parse attachments anyway. You might have the mpack package . Its munpack command saves all parts of a MIME message into separate files, then all you have to do is save the interesting parts and clean up the rest. There's also metamail . An equivalent of munpack is metamail -wy .

ubuntu - Why does my USB hdd returns SG_IO: bad/missing sense data?

I am able to boot and run commands from external USB hdd; the message in question appears for about 45 seconds then booting continues. GRUB2 is installed on internal HDD. When choosing to boot directly to /dev/sdb the message doesn't appear, however boot time is about the same as booting to internal HDD. /dev/sdb: Timing cached reads: 1018 MB in 2.00 seconds = 508.97 MB/sec Timing buffered disk reads: 80 MB in 3.03 seconds = 26.37 MB/sec pfeiffep@de:~$ sudo hdparm -i /dev/sdb /dev/sdb: SG_IO: bad/missing sense data, sb[]: 70 00 05 00 00 00 00 10 00 00 00 00 20 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 HDIO_GET_IDENTITY failed: Invalid argument Gparted correctly identifies the drive as SAMSUNG MP0402H. Any ideas how to remedy the HDIO & SG_IO messages?

Desktop reboots itself on sleep or hibernate

I have been using an ASUS M2NPV-VM motherboard for main home desktop workstation, operating Windows Vista x64. This computer has right from day one not been able to enter hibernate or standby; after Windows performs its final actions and brings the machine down, it would automatically revive itself for a reboot. Updating to the second latest BIOS (1201)has not helped (the latest BIOS revision would induce video refresh problems rendering it unusable). I have been reading related discussions on incidents similar to mine to no avail of a true workable solution. They appear to be more speculative guesses rather than actual knowledge on the inner workings of motherboard hardware. Does anybody have any electronic engineering experience on PC energy-saving standards to provide a more informed opinion how to go about getting this to work? More stories: this motherboard could not even reboot properly the first thing i used it. It was due to refresh rate of the onboard GPU, which had no influe...