@echo off for /f "tokens=2*" %%A in ('reg query HKLM\Software\Bentley\LicenseService\Install /v Location') do ( set LicSvc=%%B ) if not defined LicSvc ( echo Bentley Licensing Service could not be found! pause exit /b 1 ) for /f "tokens=2*" %%A in ('reg query HKLM\Software\Bentley\BentleyDesktopClient\Install /v Location') do ( set ConnectionClient=%%B ) "%LicSvc%/Bentley.Licensing.Service.exe" -shutdown echo Waiting for Bentley Licensing Service to shut down... :LSWaitLoop for /f "tokens=1 delims=,:" %%A in ('tasklist /fi "IMAGENAME eq Bentley.Licensing.Service.exe" /fo CSV /nh') do ( if %%A == "Bentley.Licensing.Service.exe" ( timeout /t 1 >NUL goto LSWaitLoop ) ) echo Done echo. echo Waiting for CONNECTION Client to shut down... "%ConnectionClient%\Bentley.Connect.Client.exe" -shutdown :CCWaitLoop for /f "tokens=1 delims=,:" %%A in ('tasklist /fi "IMAGENAME eq Bentley.Connect.Client.exe" /fo CSV /nh') do ( if %%A == "Bentley.Connect.Client.exe" ( timeout /t 1 >NUL goto CCWaitLoop ) ) echo Done if exist "%LocalAppData%\Bentley\MySELECT_old.db" ( del "%LocalAppData%\Bentley\MySELECT_old.db" ) rename "%LocalAppData%\Bentley\MySELECT.db" MySELECT_old.db echo. echo Restarting Bentley Licensing Service and CONNECTION Client... start "" "%LicSvc%/Bentley.Licensing.Service.exe"