A nicer bat file
Opened this issue · 2 comments
Thanks for your research on this.
It might be nice to improve the bat file to allow this to run automatically.
Here is an example:
@echo off
setlocal
if not exist "%userprofile%\Documents\Navicat\navicat-refresh.bat" (
echo "Setting up Navicat Refresh BAT"
echo "-> Move to right place if not there already"
echo "-> Setup a schedular"
echo "-> Initially run it"
echo ""
pause
echo ""
echo "Copying file to Documents \ Navicat \"
xcopy /I /Y "%~f0" "%userprofile%\Documents\Navicat\" >nul 2>&1
:: /create new sch, weekly, per 1 week, named NavicatRefresh, Run Bat file,
schtasks /create /sc WEEKLY /mo 1 /tn NavicatRefresh /tr %userprofile%\Documents\Navicat\navicat-refresh.bat
echo ""
echo "Setup scxhedule to run weekly"
echo "Opening new window for this to run for the first time....."
start "new window" "cmd /c "%userprofile%\Documents\Navicat\%~nx0""
echo "This script will now exit"
pause
exit /b 1
)
:: Check location
if not exist "%userprofile%\Documents\Navicat\" (
>&2 echo User \ Documents \ Navicat folder not exist
exit /b 1
)
if "%~dp0" == "%userprofile%\Documents\Navicat\" goto :main
:main
echo %~f0
echo "Running the refresh"
@echo off
:::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::
:: Navicat 17 / 16 / 15
:::::::::::::::::::::::::::::::::::::::::::::
:::::::::::::::::::::::::::::::::::::::::::::
echo Deleting HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium\Update
reg delete HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium\Update /f
echo Delete HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium\Registration[version and language]
for /f "tokens=*" %%i in ('REG QUERY "HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium" /s ^| findstr /L "Registration"') do (
reg delete "%%i" /va /f
)
echo Deleting Info and ShellFolder under HKEY_CURRENT_USER\Software\Classes\CLSID
for /f "tokens=*" %%k in ('reg query "HKEY_CURRENT_USER\Software\Classes\CLSID"') do (
reg query "%%k" /f "Info" /s /e | findstr /i "Info" >nul && reg delete "%%k" /f
reg query "%%k" /f "ShellFolder" /s /e | findstr /i "ShellFolder" >nul && reg delete "%%k" /f
)
echo Finished
Thank you for the suggestion! Automating the process through a script is a great idea, especially for users who are familiar with scripting. However, since we cannot confirm that deleting the Info
folders and ShellFolder
under CLSID
won’t impact other processes, it's safer for most users to use the Windows Task Scheduler GUI. This approach helps remind users of the steps they’re taking and how to delete the task if it's no longer needed. I’ll be adding a guide to the README for setting up the task through the GUI, which provides a more user-friendly and controlled method.
FYI: Another approach for automating the script is to edit the shortcut of Navicat and change the target to something like "C:\Users\name\Desktop\navicat-refresh.bat" & "C:\Program Files\PremiumSoft\Navicat Premium 17\navicat.exe"
. However, I don’t believe this is a good approach.