@rem Calling the complete command...
@echo off
setlocal
echo Installing HPE Version Control Repository Manager...
echo This might take some time please wait...
if not exist "%SystemDrive%\HPIC\logs\LimitedRelease4" mkdir "%SystemDrive%\HPIC\logs\LimitedRelease4"
set ARGUMENTS=%SystemDrive%\\HPIC\\logs\\LimitedRelease4\\
set OUTFILE=%ARGUMENTS%vcrm_output.txt
set CPQFILE=%SystemDrive%\\cpqsystem\\log\\cpqsetup.log
set VCRM_SERVICE="cpqsrhmo"
set VCRM_SERVICE_NAME="HP Version Control Repository Manager"
echo %ARGUMENTS%>>%SystemDrive%\\vcrm.txt
echo Installing HPE Version Control Repository Manager....                         >> %CPQFILE% 2>&1
echo This might take some time please wait....                                     >> %CPQFILE% 2>&1
call %~dp0\File\vcrm.exe /s                                                        
rem verify vcrm_output.txt file is created in %SystemDrive%\\HPIC\\logs\\LimitedRelease4\\

IF EXIST "%OUTFILE%" (
	copy %CPQFILE% %ARGUMENTS%      >NUL 2>&1
	for /F "tokens=1 delims= " %%x in (%OUTFILE%) do (
	if "%%x"=="Success" (
		echo Installation completed successfully.
		echo Installation completed successfully.                                 >> %ARGUMENTS%cpqsetup.log
		echo.	
		) ELSE (
		echo Failed to install, see %ARGUMENTS%cpqsetup.log for details.
		echo Failed to install, see %ARGUMENTS%cpqsetup.log for details.		  >> %ARGUMENTS%cpqsetup.log
		echo.
	  )
    )
  )

del %SystemDrive%\vcrm.txt
echo Stoping %VCRM_SERVICE_NAME%                                                  >> %ARGUMENTS%cpqsetup.log
net stop %VCRM_SERVICE%   >NUL 2>&1
exit /B %ERRORLEVEL%
endlocal
