4

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?

2
  • Does it make a difference if you use %comspec% in the second entry as well? May 28, 2012 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, 2012 at 13:27

1 Answer 1

1

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.

1
  • There is only 1 entry for JAVA_HOME and that's under "System variables".
    – Ian Kemp
    May 28, 2012 at 17:18

You must log in to answer this question.

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