@echo OFF
setlocal


echo "Unregister ..."

if exist %INSTROOT%\pgm\SAPDBSSC.ocx regsvr32 /u /s %INSTROOT%\pgm\SAPDBSSC.ocx
if exist %INSTROOT%\pgm\SAPDBxOAL.dll regsvr32 /u /s %INSTROOT%\pgm\SAPDBxOAL.dll
if exist %INSTROOT%\pgm\SAPDBxCommon.dll regsvr32 /u /s %INSTROOT%\pgm\SAPDBxCommon.dll
if exist %INSTROOT%\pgm\SAPDBxRegLib.dll regsvr32 /u /s %INSTROOT%\pgm\SAPDBxRegLib.dll
if exist %INSTROOT%\pgm\SAPDBxNavigation.ocx regsvr32 /u /s %INSTROOT%\pgm\SAPDBxNavigation.ocx
if exist %INSTROOT%\pgm\SAPDBxAutoSuppose.ocx regsvr32 /u /s %INSTROOT%\pgm\SAPDBxAutoSuppose.ocx
if exist %INSTROOT%\pgm\SAPDBxAutoSupposeObjects.dll regsvr32 /u /s %INSTROOT%\pgm\SAPDBxAutoSupposeObjects.dll
if exist %INSTROOT%\pgm\SAPDBxAbout.dll regsvr32 /u /s %INSTROOT%\pgm\SAPDBxAbout.dll
if exist %INSTROOT%\pgm\SAPDBxQueryTable.ocx regsvr32 /u /s %INSTROOT%\pgm\SAPDBxQueryTable.ocx
if exist %INSTROOT%\pgm\SAPDBxTabBar.ocx regsvr32 /u /s %INSTROOT%\pgm\SAPDBxTabBar.ocx


if exist %INSTROOT%\pgm\SAPDBQPEngine.dll del %INSTROOT%\pgm\SAPDBQPEngine.dll

echo "Copy ..."

if not exist %INSTROOT%\pgm\ mkdir %INSTROOT%\pgm\
xcopy /D \\P26326\setups\GuiClients\SQLStudio\SQLSTUDIO.exe  %INSTROOT%\pgm\
xcopy /D \\P26326\setups\GuiClients\SQLStudio\SAPDBSSC.ocx %INSTROOT%\pgm\
xcopy /D \\P26326\setups\GuiClients\Shared\SAPDBxOAL.dll %INSTROOT%\pgm\
xcopy /D \\P26326\setups\GuiClients\Shared\SAPDBxCommon.dll %INSTROOT%\pgm\
xcopy /D \\P26326\setups\GuiClients\Shared\SAPDBxRegLib.dll %INSTROOT%\pgm\
xcopy /D \\P26326\setups\GuiClients\Shared\SAPDBxNavigation.ocx %INSTROOT%\pgm\
xcopy /D \\P26326\setups\GuiClients\Shared\SAPDBxAutoSuppose.ocx %INSTROOT%\pgm\
xcopy /D \\P26326\setups\GuiClients\Shared\SAPDBxAutoSupposeObjects.dll %INSTROOT%\pgm\
xcopy /D \\P26326\setups\GuiClients\Shared\SAPDBxAbout.dll %INSTROOT%\pgm\
xcopy /D \\P26326\setups\GuiClients\Shared\SAPDBxQueryTable.ocx %INSTROOT%\pgm\
xcopy /D \\P26326\setups\GuiClients\Shared\SAPDBxTabBar.ocx %INSTROOT%\pgm\


echo "Register ..."

if exist %INSTROOT%\pgm\SAPDBSSC.ocx regsvr32  /s %INSTROOT%\pgm\SAPDBSSC.ocx
if exist %INSTROOT%\pgm\SAPDBxOAL.dll regsvr32  /s %INSTROOT%\pgm\SAPDBxOAL.dll
if exist %INSTROOT%\pgm\SAPDBxCommon.dll regsvr32 /s %INSTROOT%\pgm\SAPDBxCommon.dll
if exist %INSTROOT%\pgm\SAPDBxRegLib.dll regsvr32  /s %INSTROOT%\pgm\SAPDBxRegLib.dll
if exist %INSTROOT%\pgm\SAPDBxNavigation.ocx regsvr32  /s %INSTROOT%\pgm\SAPDBxNavigation.ocx
if exist %INSTROOT%\pgm\SAPDBxAutoSuppose.ocx regsvr32  /s %INSTROOT%\pgm\SAPDBxAutoSuppose.ocx
if exist %INSTROOT%\pgm\SAPDBxAutoSupposeObjects.dll regsvr32  /s %INSTROOT%\pgm\SAPDBxAutoSupposeObjects.dll
if exist %INSTROOT%\pgm\SAPDBxAbout.dll regsvr32  /s %INSTROOT%\pgm\SAPDBxAbout.dll
if exist %INSTROOT%\pgm\SAPDBxQueryTable.ocx regsvr32  /s %INSTROOT%\pgm\SAPDBxQueryTable.ocx
if exist %INSTROOT%\pgm\SAPDBxTabBar.ocx regsvr32  /s %INSTROOT%\pgm\SAPDBxTabBar.ocx


echo "Create Shortcut ..."

if exist %INSTROOT%\pgm\SQLSTUDIO.exe shortcut -f -t %own%\usr\pgm\SQLSTUDIO.exe -i  %own%\usr\pgm\SQLSTDO.exe -n "%USERPROFILE%\\Desktop\\SQL Studio Beta.lnk"

echo "##################"
echo "Enjoy SQL Studio Beta Version!"
echo "##################"


endlocal
