Lesvita
Lesvita

Reputation: 21

Batch File: Installation was unexpected at this time

Error: Installation unexpected at this time.

The error occurs in the Highlighted (bold) echo statement after the application is installed when Im running this script on CMD. I have tried with removing @ECHO OFF but didn't seem to work.Please suggest.

Below is the code:

@ECHO OFF
REM Setting the Package Name
SET PACKAGENAME=OracleCorporation-CrystalBall-11.1.4100.0-EN
SET LOGDIR=%Systemdrive%\Logs\CrystalBall
SET BATCHLOG=%LOGDIR%\%PACKAGENAME%_BatchInstall.log
IF NOT EXIST "%Systemdrive%\Logs\CrystalBall" MD "%Systemdrive%\Logs\CrystalBall"
ECHO %DATE% %TIME% >> %BATCHLOG%
rem Setting the LOGDIR path
SET LOG1=%LOGDIR%\OrcaleCorporation-OracleCrystalBall-EN_Install.log
REM Setting the current directory path
cd /d %~dp0
:Crystal
ECHO Starting installation of Oracle Crystal Ball (32-bit) >> %BATCHLOG%
REG QUERY HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Uninstall\{878FE383-4153-4C76-9F17-F1277FBBD670} /v DisplayName /REG:32
IF %ERRORLEVEL% EQU 0 GOTO :End
start /wait "inst" "%CD%\Setup\Inst\setup.msi" /qn /L*V %LOG1%
**ECHO completed installing Oracle Crystal Ball (32-bit) with %Errorlevel% >> %BATCHLOG%**
If %Errorlevel% NEQ 0 (
    If %Errorlevel% NEQ 3010 (
        If %Errorlevel% NEQ 1641 (
            ECHO Error occured Ending Oracle Crystal Ball (32-bit) Installation >> %BATCHLOG%
            goto :End
        )
    )
)
:End
ECHO Completed Installation of Oracle Crystal Ball (32-Bit) at %DATE% %TIME% >> %BATCHLOG%

Upvotes: 0

Views: 1040

Answers (1)

Stephan
Stephan

Reputation: 56180

the error isn't in the line, you marked, but some lines later at:

ECHO Error occured Ending Oracle Crystal Ball (32-bit) Installation >> %BATCHLOG%

The closing paranthese ) closes your IF code block (too early) instead of being just echoed. So the word behind (Installation) is parsed as a command, which gives you the errormessage.

You have to "escape" this ) with a caret:

ECHO Error occured Ending Oracle Crystal Ball (32-bit^) Installation >> %BATCHLOG%

(Note: some people like to also escape ^), which is technically not needed, but for symmetry/readability...)

Upvotes: 1

Related Questions