Skip to content
Permalink
Browse files

fix and change to updater

if construction is unstable with setlocal
updating is better even e.g. when java has been updated
  • Loading branch information...
zack-vii authored and joshStillerman committed Sep 1, 2015
1 parent d8ccfc8 commit e0213824be1e6c430627870f6582555154914af0
Showing with 5 additions and 8 deletions.
  1. +5 −8 setJDK_DIR.bat
@@ -1,13 +1,10 @@
@echo off
if not defined JDK_DIR (
rem This script located the current version of
@ECHO OFF
rem This script locates the current version of
rem "Java Development Kit" and sets the
rem %JDK_PATH% environment variable
setlocal ENABLEEXTENSIONS
set KEY=HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit
SETLOCAL ENABLEEXTENSIONS
SET KEY=HKEY_LOCAL_MACHINE\SOFTWARE\JavaSoft\Java Development Kit
FOR /F "usebackq tokens=2,* skip=2" %%L IN (`reg query "%KEY%" /v CurrentVersion`) DO SET JDKVER=%%M
FOR /F "usebackq tokens=2,* skip=2" %%L IN (`reg query "%KEY%\%JDKVER%" /v JavaHome`) DO SET JDK_DIR="%%M"
setlocal DISABLEEXTENSIONS
SET JDK_DIR=%JDK_DIR%
SETX JDK_DIR %JDK_DIR%
)
SETX JDK_DIR %JDK_DIR%

0 comments on commit e021382

Please sign in to comment.
You can’t perform that action at this time.