@echo OFF
setlocal

if not exist "\\P26326\setups\GuiClients\Problem Tracking System\PTS Admin Tools" goto notavailable

echo Unregister ...

if exist %TOOL%\PTS\PTSAdminControls.ocx	regsvr32 /u /s %TOOL%\PTS\PTSAdminControls.ocx
if exist %TOOL%\PTS\SAPDBxCommon.dll        regsvr32 /u /s %TOOL%\PTS\SAPDBxCommon.dll
if exist %TOOL%\PTS\SAPDBxDBCOM.dll         regsvr32 /u /s %TOOL%\PTS\SAPDBxDBCOM.dll
if exist %TOOL%\PTS\SAPDBxKeyManagement.dll regsvr32 /u /s %TOOL%\PTS\SAPDBxKeyManagement.dll

echo Copy ...

xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS Admin Tools\PTSAdminClose.exe"		%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS Admin Tools\PTSAdminControls.ocx"	%TOOL%\PTS

xcopy /D "\\P26326\setups\GuiClients\Shared\SAPDBxCommon.dll"										%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Shared\SAPDBxDBCOM.dll"										%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Shared\SAPDBxKeyManagement.dll"								%TOOL%\PTS

echo Register ...

if exist %TOOL%\PTS\PTSAdminControls.ocx	regsvr32 /s %TOOL%\PTS\PTSAdminControls.ocx
if exist %TOOL%\PTS\SAPDBxCommon.dll        regsvr32 /s %TOOL%\PTS\SAPDBxCommon.dll
if exist %TOOL%\PTS\SAPDBxDBCOM.dll         regsvr32 /s %TOOL%\PTS\SAPDBxDBCOM.dll
if exist %TOOL%\PTS\SAPDBxKeyManagement.dll regsvr32 /s %TOOL%\PTS\SAPDBxKeyManagement.dll

echo Create Shortcut ...

if exist %TOOL%\PTS\PTSAdminClose.exe shortcut -f -t %TOOL%\PTS\PTSAdminClose.exe -i  %TOOL%\PTS\PTSAdminClose.exe -n "%USERPROFILE%\\Desktop\\PTSAdminClose.lnk"

echo ##############################
echo     Enjoy PTS Admin Tools !
echo ##############################

goto installend

:notavailable

echo ##############################################
echo     PTS Admin Tools not properly installed!
echo ##############################################

:installend

endlocal
