@echo OFF
setlocal

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

echo Unregister ...

if exist %TOOL%\PTS\SAPDBCTSClient.ocx		regsvr32 /u /s %TOOL%\PTS\SAPDBCTSClient.ocx
if exist %TOOL%\PTS\SAPDBCTSObjects.dll     regsvr32 /u /s %TOOL%\PTS\SAPDBCTSObjects.dll
if exist %TOOL%\PTS\SAPDBPTSAdmin.ocx       regsvr32 /u /s %TOOL%\PTS\SAPDBPTSAdmin.ocx
if exist %TOOL%\PTS\SAPDBPTSDBAL.dll        regsvr32 /u /s %TOOL%\PTS\SAPDBPTSDBAL.dll
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\SAPDBxExplorer.ocx      regsvr32 /u /s %TOOL%\PTS\SAPDBxExplorer.ocx
if exist %TOOL%\PTS\SAPDBxKeyManagement.dll regsvr32 /u /s %TOOL%\PTS\SAPDBxKeyManagement.dll
if exist %TOOL%\PTS\SAPDBxRegLib.dll		regsvr32 /u /s %TOOL%\PTS\SAPDBxRegLib.dll
if exist %TOOL%\PTS\SAPDBxSplitterBox.ocx   regsvr32 /u /s %TOOL%\PTS\SAPDBxSplitterBox.ocx
if exist %TOOL%\PTS\SAPDBxTraceServer.dll   regsvr32 /u /s %TOOL%\PTS\SAPDBxTraceServer.dll

if exist %TOOL%\PTS\PTSAdminControls.ocx	regsvr32 /u /s %TOOL%\PTS\PTSAdminControls.ocx

echo Copy ...

xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS\PTS.exe"				%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS\SAPDBCTSClient.ocx"	%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS\SAPDBCTSObjects.dll"	%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS\SAPDBPTSAdmin.ocx"		%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS\SAPDBPTSDBAL.dll"		%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS\SQLOD32.dll"			%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS\SQLSP32.dll"			%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS\SQLUSER.dll"			%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS\SQLTCP.dll"			%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS\SQLTCPN.dll"			%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS\SQLTCP1.dll"			%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS\SQLTCP2.dll"			%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS\SQLOD32.dll.q"			%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS\SQLSP32.dll.q"			%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\SAPDBxExplorer.ocx"							%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Shared\SAPDBxKeyManagement.dll"					%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Shared\SAPDBxRegLib.dll"							%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Shared\SAPDBxSplitterBox.ocx"						%TOOL%\PTS
xcopy /D "\\P26326\setups\GuiClients\Shared\SAPDBxTraceServer.dll"						%TOOL%\PTS

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

echo Register ...

if exist %TOOL%\PTS\SAPDBCTSClient.ocx		regsvr32 /s %TOOL%\PTS\SAPDBCTSClient.ocx
if exist %TOOL%\PTS\SAPDBCTSObjects.dll     regsvr32 /s %TOOL%\PTS\SAPDBCTSObjects.dll
if exist %TOOL%\PTS\SAPDBPTSAdmin.ocx       regsvr32 /s %TOOL%\PTS\SAPDBPTSAdmin.ocx
if exist %TOOL%\PTS\SAPDBPTSDBAL.dll        regsvr32 /s %TOOL%\PTS\SAPDBPTSDBAL.dll
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\SAPDBxExplorer.ocx      regsvr32 /s %TOOL%\PTS\SAPDBxExplorer.ocx
if exist %TOOL%\PTS\SAPDBxKeyManagement.dll regsvr32 /s %TOOL%\PTS\SAPDBxKeyManagement.dll
if exist %TOOL%\PTS\SAPDBxRegLib.dll		regsvr32 /s %TOOL%\PTS\SAPDBxRegLib.dll
if exist %TOOL%\PTS\SAPDBxSplitterBox.ocx   regsvr32 /s %TOOL%\PTS\SAPDBxSplitterBox.ocx
if exist %TOOL%\PTS\SAPDBxTraceServer.dll   regsvr32 /s %TOOL%\PTS\SAPDBxTraceServer.dll

if exist %TOOL%\PTS\PTSAdminControls.ocx	regsvr32 /s %TOOL%\PTS\PTSAdminControls.ocx

echo Create Shortcut ...

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

echo ##################
echo     Enjoy PTS !
echo ##################

goto installend

:notavailable

echo ###################################
echo     PTS not properly installed!
echo ###################################

:installend

endlocal
