i am having to learn DOS and batch programming in a crash-course style, in trying to automate a series of installs i need to do whenever creating a master image. i do have some programming background in BASIC, and more recently, Java.
i have a 'master' batch which instantiates marker variables at 0, one for each program i need to install, then goes through with a series of IF EXIST . . . SET to set the markers to 1 if the program has already been installed.
In the next section, the markers are used to determine which secondary batch file is called (START /WAIT . . . ) to perform the actual install. In theory, after that secondary batch is done, control should return to the master batch and resume on the next line after the START, which checks the marker for the next program on the list.
However, i keep getting caught up short with a "=0 was unexpected at this time." right after the last program is checked for and marker set; it then goes to the next section but stops at the first line and ends. When i inserted a series of SET var lines, to repeat the variables' values (so i could see if they'd set correctly), that error appeared right after them but still before the next section. So it seems that it has something to do with the first section checking the state of the marker to determine whether to call the secondary batch. i can't find a statement there that would display anything.
Each individual batch works fine.
Here's the code. The error occurs at the entry to :instapps, and :dispvar is a temporary section, just to test the validity of the previous marker-setting method. Thanks for any ideas!
========================
:: INITINST.BAT ::
:: Main batch to go through installation of applications required for
:: District images. Specialised apps will have to be manually installed.
:: This file will call other batch-files and remain open; control will
:: return to this file as others complete their jobs.
:: This file will delete itself after Sybase reboot and configuration.
:: 02 feb 2007, eh
:: v1.1 -- 05 feb -- placed aeries install just after office, before novell eh
:: v1.2 -- 05 feb -- discovered loop in :instapps; removed GOTO appcheck; app marker variable will be set to 1 in appropriate batch-files eh
TITLE Main installation script
:: VARIABLE LIST ::
:: %SDC% = SDCS_Tools directory
SET SDC=0
:: %ADO% = Adobe Reader
SET ADO=0
:: %AQT% = Apple QuickTime
SET AQT=0
:: %WMP% = Windows Media Player
SET WMP=0
:: %OFC% = Microsoft Office 2003
SET OFC=0
:: %NOV% = Novell client
SET NOV=0
:: %SQL% = SQL 7
SET SQL=0
:: %EZY% = Aeries/Easy
SET EZY=0
:: %SYB% = Sybase
SET SYB=0
:: 0=uninstalled, 1=installed
:: %SRC% = Batch-file source path
SET SRC=G:\
:: Check for installed applications
:appcheck
::Check for C:\SDCS_Tools
IF EXIST c:\SDCS_Tools SET SDC=1
::Directory exists; reset marker
::Check for Adobe Reader
IF EXIST c:\progra~1\adobe SET ADO=1
::Reader has been installed; reset marker
::Check for Apple QuickTime
IF EXIST c:\progra~1\quickt~1 SET AQT=1
::QuickTime has been installed; reset marker
::Check for Windows Media Player
IF EXIST c:\progra~1\window~2\wmsetsdk.exe SET WMP=1
::WMP10 has been installed; reset marker
::Check for MS Office 2003
IF EXIST c:\progra~1\micros~2 SET OFC=1
::Office has been installed; reset marker
::Check for Aeries
IF EXIST c:\easy SET EZY=1
::Aeries has been installed; reset marker
::Check for Novell Client
IF EXIST c:\novell SET NOV=1
::Novell has been installed; reset marker
::Check for SQL 7
IF EXIST c:\mssql7 SET SQL=1
::SQL has been installed; reset marker
::Check for Sybase
IF EXIST c:\sybase SET SYB=1
::Sybase has been installed; reset marker
:: For testing purposes:
:dispvar
SET SDC
SET ADO
SET AQT
SET WMP
SET OFC
SET EZY
SET NOV
SET SQL
SET SYB
:: Use markers to pick up where installation left off.
:instapps
::SDCS_Tools
IF %SDC%=0 START /WAIT %SRC%copyfld.bat
::Directory hasn't been copied yet; switch to that batch-file.
::Adobe Reader
IF %ADO%=0 START /WAIT %SRC%instado.bat
::Apple QuickTime
IF %AQT%=0 START /WAIT %SRC%instqt.bat
::Windows Media Player
IF %WMP%=0 START /WAIT %SRC%instwmp.bat
::MS Office 2003
IF %OFC%=0 START /WAIT %SRC%instofc.bat
::Aeries/Easy
IF %EZY%=0 START /WAIT %SRC%instezy.bat
::Novell Client
IF %NOV%=0 SET /P NOVAD Does Novell need to be installed? (y/n)
IF /I %NOVAD%==y START /WAIT %SRC%instnov.bat
SET %NOV%=1
::SQL 7
IF %SQL%=0 START /WAIT %SRC%instsql.bat
::Sybase
IF %SYB%=0 START /WAIT %SRC%instsyb.bat
:: Everything is installed and Sybase DS_Edit needs to be configured.
:postsyb
ECHO.
ECHO When the DS_Edit window appears:
ECHO 1. Click OK
ECHO 2. Create a New Server Object with the name of Horizon
ECHO 3. Double-click on the Server Address field
ECHO 4. Click Add
ECHO 5. Into the Network Address field type:
ECHO [deleted]
ECHO 6. Click OK twice
ECHO 7. Close DS_Edit
ECHO.
PAUSE
:: Everything has now been installed and configured except specialised apps.
:finale
CLS
ECHO.
ECHO District standard apps have now been installed.
ECHO Any software specific to this model should now be manually installed.
PAUSE