@echo OFF
setlocal

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

echo Unregister ...

if exist .\SAPDBxCommon.dll         regsvr32 /u /s .\SAPDBxCommon.dll
if exist .\SAPDBxDBCOM.dll          regsvr32 /u /s .\SAPDBxDBCOM.dll
if exist .\SAPDBxKeyManagement.dll  regsvr32 /u /s .\SAPDBxKeyManagement.dll
if exist .\SAPDBxRegLib.dll			regsvr32 /u /s .\SAPDBxRegLib.dll
if exist .\SAPDBxTraceServer.dll    regsvr32 /u /s .\SAPDBxTraceServer.dll

echo Copy ...

xcopy /D "\\P26326\setups\GuiClients\Problem Tracking System\PTS Migration\PTSMigration.exe"		.

xcopy /D "\\P26326\setups\GuiClients\Shared\SAPDBxCommon.dll"									.
xcopy /D "\\P26326\setups\GuiClients\Shared\SAPDBxDBCOM.dll"									.
xcopy /D "\\P26326\setups\GuiClients\Shared\SAPDBxKeyManagement.dll"							.
xcopy /D "\\P26326\setups\GuiClients\Shared\SAPDBxRegLib.dll"									.
xcopy /D "\\P26326\setups\GuiClients\Shared\SAPDBxTraceServer.dll"								.

echo Register ...

if exist .\SAPDBxCommon.dll         regsvr32 /s .\SAPDBxCommon.dll
if exist .\SAPDBxDBCOM.dll          regsvr32 /s .\SAPDBxDBCOM.dll
if exist .\SAPDBxKeyManagement.dll  regsvr32 /s .\SAPDBxKeyManagement.dll
if exist .\SAPDBxRegLib.dll			regsvr32 /s .\SAPDBxRegLib.dll
if exist .\SAPDBxTraceServer.dll    regsvr32 /s .\SAPDBxTraceServer.dll

echo Create Shortcut ...

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

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

goto installend

:notavailable

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

:installend

endlocal
