Skip to content

Instantly share code, notes, and snippets.

@mperry
Last active August 29, 2015 13:58
Show Gist options
  • Save mperry/9999570 to your computer and use it in GitHub Desktop.
Save mperry/9999570 to your computer and use it in GitHub Desktop.
Switches java versions and add the new JAVA_HOME to the front of the PATH.
@echo off
set VERSION=%1
call setEnvVar JAVA_HOME JAVA%VERSION%_HOME
echo JAVA_HOME=%JAVA_HOME%
@echo off
set WRITE=%1
set READ=%2
:main
call :myset %WRITE% %%READ%%
goto :end
:myset
for /F "usebackq tokens=*" %%i in (`echo %%%2%%`) do set %1=%%i&& set PATH=%%i\bin;%PATH%
goto :eof
:end
set WRITE=
set READ=
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment