:: Inspired by http://www.robvanderwoude.com (for the Properties parsing) @echo off if exist .\iaik_jce*.jar ( echo Libraries have already been copied GOTO:EOF ) echo Copying required jars... copy ..\configtool\lib\sap.com~tc~bl~offline_launcher~impl.jar .\sap.com~tc~bl~offline_launcher~impl.jar copy ..\configtool\lib\sap.com~tc~exception~impl.jar .\sap.com~tc~exception~impl.jar copy ..\configtool\lib\sap.com~tc~sec~secstorefs~java~core.jar .\sap.com~tc~sec~secstorefs~java~core.jar echo Parsing the config file for location of crypto lib :: Check Windows version IF NOT "%OS%"=="Windows_NT" GOTO Syntax :: Keep variables local SETLOCAL :: Properties File and Key SET INIFile=..\configtool\config.properties SET INIKey=secstorefs.lib SET INIValue= :: Reset temporary variables SET KeyFound=0 :: Search the INI file line by line FOR /F "tokens=* delims=" %%A IN ('TYPE %INIFile%') DO CALL :ParseINI "%%A" :: once this is completed ENDLOCAL & SET INIValue=%INIValue% GOTO:COPYSECSTORE :ParseINI SET Line="%~1" IF "%KeyFound%"=="1" GOTO:EOF :: Parse any "key=value" line FOR /F "tokens=1* delims==" %%a IN ('ECHO.%Line%') DO ( SET Key=%%a^" SET Value=^"%%b ) :: Strip quotes from key and value SET Value=%Value:"=% SET Key=%Key:"=% :: Check if the key matches the required key IF /I "%Key%"=="%INIKey%" ( SET INIValue=%Value% SET KeyFound=1 ) GOTO:EOF :COPYSECSTORE :: Remove the escape for the ":" in the path SET First=%INIValue:~0,1% SET Rest=%INIValue:~2% SET INIValue=%First%%Rest%\\tools\\iaik_jce*.jar echo Copying crypto lib from %INIValue% copy %INIValue% .\iaik_jce*.jar if %errorlevel% NEQ 0 ( echo Could not find the iaik_jce.jar in the configured path, trying hard-coded path copy ..\..\..\SYS\global\security\lib\tools\iaik_jce*.jar .\iaik_jce*.jar ) )