anchor.diff:  
   :: ========================================================================
   ::
  +:: VirtualBox
  +::
  +:: ========================================================================
  +
  +if exist "%ProgramFiles%\Oracle\VirtualBox" set "PATH=%PATH%;%ProgramFiles%\Oracle\VirtualBox"
  +
  +:: ========================================================================
  +::
  +:: Java
  +::
  +:: ========================================================================
  +
  +call :cmd.env.lookup.java jre
  +call :cmd.env.lookup.java jdk
  +
  +if defined JDK_HOME (
  +	call :cmd.env.set.home JAVA_HOME "%JDK_HOME%"
  +) else if defined JRE_HOME (
  +	call :cmd.env.set.home JAVA_HOME "%JRE_HOME%"
  +)
  +
  +:: ========================================================================
  +::
   :: Integration with ConEmu
   ::
   :: ========================================================================
  
positive.code: ::
  :: ========================================================================
  
  set "IUM_HOME=C:\IUM"
  if exist "%IUM_HOME%" set "PATH=%PATH%;%IUM_HOME%\bin"
  :: if exist "%IUM_HOME%\Solid" set "PATH=%PATH%;%IUM_HOME%\Solid\bin"
  :: if exist "%IUM_HOME%\mysql" set "PATH=%PATH%;%IUM_HOME%\mysql\bin"
  
  :: ========================================================================
  ::
  
negative.code: 
  :: ========================================================================
  
  goto :EOF
  
  :: ========================================================================
  
  :cmd.env.lookup.java
  set "%~1_HOME="
  for /f %%d in ( '
  	dir /b "%ProgramFiles%\Java\%~1*" "%ProgramFiles(x86)%\Java\%~1*" ^| sort
  ' ) do if exist "%ProgramFiles%\Java\%%d" (
  	set "%~1_HOME=%ProgramFiles%\Java\%%d"
  ) else (
  	set "%~1_HOME=%ProgramFiles(x86)%\Java\%%d"
  )
  goto :EOF
  
  
  :cmd.env.set.home
  if defined %~1 goto :EOF
  
  :: Set all provided paths to %PATH%
  call :cmd.env.set.path "%~2\bin"     "%~3" && set "%~1=%~2"
  call :cmd.env.set.path "%~2\sbin"    "%~3" && set "%~1=%~2"
  call :cmd.env.set.path "%~2\usr\bin" "%~3" && set "%~1=%~2"
  call :cmd.env.set.path "%~2"         "%~3" && set "%~1=%~2"
  goto :EOF
  
  
  :cmd.env.select.set.path
  :: Only one of these paths will be appended to %PATH%
  call :cmd.env.set.path "%~1\bin" "%~2" && goto :EOF
  call :cmd.env.set.path "%~1\cmd" "%~2" && goto :EOF
  call :cmd.env.set.path "%~1"     "%~2" && goto :EOF
  goto :EOF
  
  
  :cmd.env.set.path
  :: Check if the path is not specified in %PATH% and contains executables
  call :cmd.env.check.path "%~1" || goto :EOF
  
  :: Append or prepend new path to %PATH%
  if /i "%~2" == "/P" (
  	set "PATH=%~1;%PATH%"
  ) else (
  	set "PATH=%PATH%;%~1"
  )
  ::if /i     "%~2" == "/P" set "PATH=%~1;%PATH%"
  ::if /i not "%~2" == "/P" set "PATH=%PATH%;%~1"
  goto :EOF
  
  
  :cmd.env.check.path
  :: Skip if the path is specified in %PATH%
  for %%p in ( "%PATH:;=" "%" ) do if /i "%~1" == "%%~p" exit /b 1
  
  :: Skiep if no executables in the path
  dir /b /a-d "%~1\*.exe" "%~1\*.bat" "%~1\*.cmd" >nul 2>nul
  
  goto :EOF
  
  :: ========================================================================
  
  :: EOF
  