@echo off

echo =========================================================================
echo 请不要关闭本窗口，否则将会导致安装产生错误。
echo 系统正在自动配置超级IIS，这需要一些时间，请耐心等待...
echo 程序执行完毕后，将自动关闭本窗口。
echo =========================================================================

for /d %%d in (*) do (
 if exist %%d\bin\java.exe set jdk_dir=%%d
 if exist %%d\bin\tomcat6.exe set tomcat_dir=%%d
)
if "%jdk_dir%"=="" echo ..
if "%tomcat_dir%"=="" echo ...

set jtm_path=%cd%
set class_path=.;%jtm_path%\%jdk_dir%\lib;%jtm_path%\%jdk_dir%\lib\tools.jar;%jtm_path%\jtm\jtm.jar
set java="%jtm_path%\%jdk_dir%\bin\java.exe" -classpath "%class_path%"

%java% CheckPath "%jtm_path%"
if errorlevel 1 echo. & pause & exit

%java% WriteConfig "%jtm_path%\jtm\config.cmd" "%jtm_path%\%tomcat_dir%"

if exist jtm\config.cmd (call jtm\config.cmd && goto :eof) else echo jtm\config.cmd 不存在. & pause & exit