Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a command setup in the Registry as a folder association, so I can shift + right-click any folder and open a VS2010 prompt there, instead of having to open a command prompt and then CD to the directory I'm working in. But it's not working...

Setup:

JAVA_HOME is set to C:\Program Files\Java\jdk1.7.0_04 in Computer > Advanced system settings > Environment Variables...

When I do the following the correct value is output:

Start > Visual Studio Command Prompt (2010) (%comspec% /k ""C:\Program Files (x86)\Microsoft Visual Studio 2010 Premium\VC\vcvarsall.bat"" x86):

Output (correct):

Setting environment for using Microsoft Visual Studio 2010 x86 tools.

C:\Program Files (x86)\Microsoft Visual Studio 2010 Premium\VC>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.7.0_04

But when I do the following the wrong (old) value is used:

Shift + right-click a folder, select "Open VS2010 prompt here" (cmd /k ""C:\Program Files (x86)\Microsoft Visual Studio 2010 Premium\VC\bin\vcvars32.bat" x86 && cd /d "%V" && title Visual Studio Command Prompt (2010)" in the Registry):

Output (wrong):

Setting environment for using Microsoft Visual Studio 2010 x86 tools.

E:\Hg>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_27

Why are the values different??? Where is the second instance reading these values from?

share|improve this question
    
Does it make a difference if you use %comspec% in the second entry as well? – Oliver Salzburg May 28 '12 at 17:21
    
@Oliver Salzburg: %comspec% doesn't get expanded when run from the Registry. I created a batch file that calls %comspec%/k ""C:\Program Files (x86)\Microsoft Visual Studio 2010 Premium\VC\bin\vcvars32.bat" x86 && cd /d "%V" && title Visual Studio Command Prompt (2010)" and called that from the Registry - gives same (wrong) behaviour as 2nd case above. – Ian Kemp Jun 4 '12 at 13:27

Please note that there are 2 sets of environment variables. One for the user and one for the entire system:

enter image description here

Make sure to have both adjusted. Sometimes the user variables are set, sometimes they aren't.

share|improve this answer
    
There is only 1 entry for JAVA_HOME and that's under "System variables". – Ian Kemp May 28 '12 at 17:18

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .