@Echo off


cd /d "%~dp0"
ECHO ..................................................
ECHO Copying Installable Software For CCTNS Application
ECHO ..................................................

ECHO Creating local directory

MKDIR "%temp%\cctnsClientSoftware"

ECHO Copying Installable file into local drive

xcopy .\InstallableSoftware  %temp%\cctnsClientSoftware   /e /i /h


cls

ECHO Installing Java 1.6.0_23, Please be patient
%temp%\cctnsClientSoftware\jdk-6u23-windows-i586.exe

:: BatchGotAdmin (Run as Admin code starts)
REM  --> Check for permissions
>nul 2>&1 "%SYSTEMROOT%\system32\cacls.exe" "%SYSTEMROOT%\system32\config\system"

REM --> If error flag set, we do not have admin.
if '%errorlevel%' NEQ '0' (
    echo Requesting administrative privileges...
    goto UACPrompt
) else ( goto gotAdmin )

:UACPrompt
    echo Set UAC = CreateObject^("Shell.Application"^) > "%temp%\getadmin.vbs"
    echo UAC.ShellExecute "%~s0", "", "", "runas", 1 >> "%temp%\getadmin.vbs"

    "%temp%\getadmin.vbs"
    exit /B

:gotAdmin
    if exist "%temp%\getadmin.vbs" ( del "%temp%\getadmin.vbs" )
    pushd "%CD%"
    CD /D "%~dp0"
:: BatchGotAdmin (Run as Admin code ends)

setx -m JAVA_HOME "C:\Program Files (x86)\Java\jdk1.6.0_23"
setx -m JRE_HOME "C:\Program Files (x86)\Java\jre6"


SET ANT_HOME=%temp%\cctnsClientSoftware\Ant
set WORKING_DIRECTORY=%ANT_HOME%
SET  PATH=%PATH%;%ANT_HOME%\bin;

SET ant_log_directory=C:\cctns_offline_installation_log
if not exist %ant_log_directory% mkdir %ant_log_directory%

echo %PATH%

PAUSE
ECHO ...............................................
ECHO Installing CCTNS Application (Complete-Server)
ECHO ...............................................
ant

PAUSE