@echo off
@REM
@REM Copyright (c) 2018-2022
@REM Beijing Baolande Software Corporation
@REM
@REM All Rights Reserved
@REM

set PATCH_ROOT=%BES_HOME%\patch

:conflict
set suffix=%random%
if exist %BIN_HOME%setpatchenvtmp%suffix% goto conflict

"%JAVA_BASE%\bin\java" %JAVA_OPTS% -cp "%BES_HOME%\lib\bootstrap\bes-patch.jar" -Dcom.bes.installRoot="%BES_HOME%" -Dcom.bes.instanceRoot="%BES_ROOT%" com.bes.patch.cli.PatchEnv %* > "%BIN_HOME%setpatchenvtmp%suffix%"
for /f "usebackq delims==" %%p in ("%BIN_HOME%setpatchenvtmp%suffix%") do (
  set PATCH_CLASSPATH=%%p
)
del "%BIN_HOME%setpatchenvtmp%suffix%"