I am trying to create a batch file, where based on criteria, it will go to a section in the batch file. At the moment its only partially working. If I choose 'Y' for installing 'Holmes' , 'N' for 'ReportServer' and 'N' for 'Apache' then it will prompt me for "Enter SQLServerName". However if I choose 'N' for installing Holmes and 'Y' for installing 'ReportServer' then it should ask me the same question to "Enter SQLServername", but at the moment it goes to end. Anyone know what to do to get this working correctly?
setlocal ENABLEDELAYEDEXPANSION
set SETTINGS_FILE=c:\temp\settings.txt
if "%InstallHolmes%"=="" (
choice /C yn /N /M "Do you want to install Holmes? : "
if %ERRORLEVEL% ==1 (
set InstallHolmes=Y
) else (
set InstallHolmes=N
)
echo InstallHolmes=!InstallHolmes! >> %SETTINGS_FILE%
)
if "%InstallReportServer%"=="" (
choice /C yn /N /M "Do you want to install Report Server? : "
if %ERRORLEVEL% ==1 (
set InstallReportServer=Y
) else (
set InstallReportServer=N)
)
echo InstallReportServer=!InstallReportServer! >> %SETTINGS_FILE%
)
if "%InstallApache%"=="" (
choice /C yn /N /M "Do you want to install Apache? : "
if %ERRORLEVEL% ==1 (
set InstallApache=Y
) else (
set InstallApache=N
)
echo InstallApache=!InstallApache! >> %SETTINGS_FILE%
)
set "TRUE="
if "%InstallHolmes%"=="Y" set TRUE=1
if "%InstallReportServer%"=="Y" set TRUE=1
if "%TRUE%" == "1" set InstallEitherAppOrReports=Y
if "%TRUE%" == "1" goto sqlinfo
set "TRUE="
if "%InstallHolmes%"=="N" set TRUE=2
if "%InstallReportServer%"=="N" set TRUE=2
if "%TRUE%" == "2" goto end
:sqlinfo
if "%SQLServer%"=="" (
set /p SQLServer="Enter SQLServer name : "
echo SQLServer=!SQLServer!>> %SETTINGS_FILE%
)
)
Aucun commentaire:
Enregistrer un commentaire