Solve the problem of `SQLyog Trial` trial expiration (provide a script solution)

This article will summarize SQLyog Trialissues with trial expiration.

In fact, the solution is very simple, just delete the SQLyog related registry.

1. Registry entries to be deleted

Win+ROpen Run, enter regeditEnter, open the registry and find this string of items
under the path (not sure if everyone's is the same, look for it yourself and find the one it contains )HKEY_CURRENT_USER\SOFTWARE{d58cb4b1-47f3-45cb-a209-f298d0c3f756}
InD110、InU值

Insert image description here
Delete this item to solve the problem

2. Wrote a script to do this

It seems acceptable to have to manually delete this every 14 days, but I still wrote a script to do the job.
Directly upload the script content (bat script)

@echo off

title batch script for SQLyog

REM 以管理员身份运行(开启后每次运行该脚本生成的快捷方式都会闪一下)
REM %1 mshta vbscript:CreateObject("Shell.Application").ShellExecute("cmd.exe","/c "^&chr(34)^&"%~0"^&chr(34)^&" ::","%cd%","runas",1)(window.close)&&exit


REM 请改为你本地SQLyog安装位置
set sqlyog_dir=E:\Program Files\SQLyog Trial
set sqlyog_app=%sqlyog_dir%\SQLyog.exe

REM SQLyog注册表key,可能跟你的不一样,如果不一样,请替换为你的
set sqlyog_reg_key=HKEY_CURRENT_USER\SOFTWARE\{
    
    d58cb4b1-47f3-45cb-a209-f298d0c3f756}

if "%1"=="shortcut" (
	call :delete_reg_key
	call :start_sqlyog
) else (
	call :create_shortcut
)
 
exit /b


:delete_reg_key

	REM 判断注册表是否存在,如果存在删除注册表项
	reg query %sqlyog_reg_key%
	if %errorlevel%==0 (
	  reg delete %sqlyog_reg_key% /f
	)
	goto :EOF


:create_shortcut

	REM 快捷方式信息
	set shortcut_name=SQLyog.lnk
	set shortcut_folder=%UserProfile%\Desktop
	set shortcut_path=%shortcut_folder%\%shortcut_name%
	set shortcut_description=This is a shortcut created for the bat script, the script is mainly to delete the registry key about the trial period.

	REM 判断快捷方式是否存在,如果不存在则创建之,存在则不创建
	for %%I in ("%shortcut_path%") do (set existing_shortcut=%%~fI)

	if exist "%existing_shortcut%" (
		goto :EOF
	)

	REM 通过SQLyog.exe获取SQLyog的icon
	set icon_file=%sqlyog_app%
	set icon_index=0
	set working_dir=%sqlyog_dir%
	set the_scene=shortcut

	REM 获取当前脚本的绝对路径
	set script_path=%~f0

	REM 开始菜单路径
	set start_menu_dir=%ProgramData%\Microsoft\Windows\Start Menu\Programs

    REM 为当前脚本创建快捷方式(为了便于设别,且美观,设置快捷方式的图标为SQLyog的icon)
	powershell -Command "$WshShell = New-Object -ComObject WScript.Shell; $Shortcut = $WshShell.CreateShortcut('%shortcut_path%'); $Shortcut.TargetPath = '%script_path%'; $Shortcut.WorkingDirectory = '%working_dir%'; $Shortcut.Arguments = '%the_scene%' ; $Shortcut.IconLocation = '%icon_file%,%icon_index%'; $Shortcut.Description = '%shortcut_description%'; $Shortcut.Save()"

	REM 将创建的快捷方式,copy一份到开始菜单(需要管理员权限运行才能成功copy)
	echo F | xcopy "%shortcut_path%" "%start_menu_dir%\%shortcut_name%" /y
	
	goto :EOF

	
:start_sqlyog

	REM 启动应用程序并退出脚本
	start "" "%sqlyog_app%"
	
	goto :EOF
	

Explanation:
1) Theoretically, the script can be placed anywhere, but it is recommended to place it in the SQLyog installation directory;
2) There are two places in the script that need to be modified:

  • SQLyog installation path set sqlyog_dir=E:\Program Files\SQLyog Trial, change it to your own;
  • If the registry key set sqlyog_reg_key=HKEY_CURRENT_USER\SOFTWARE\{d58cb4b1-47f3-45cb-a209-f298d0c3f756}is different from mine, change it to your own;

3) When the script is run for the first time, a shortcut will be created on the current user's desktop. The shortcut is linked to the script, but the icon of the shortcut uses the icon of SQLyog. In addition, if you need to create a shortcut in [Start Menu], you need to run the script as an administrator, otherwise the creation may not be successful; 4) After the shortcut is created, every time you open the
shortcut, you will first go to Delete the SQLyog registry entry and then start the SQLyog program, so every time you open the SQLyog program, there is a 14-day trial period.

3. Finally

In fact, you can also just write a script to delete the registry, and then configure it in the [Task Scheduler] to perform the deletion task regularly.

@echo off

REM SQLyog注册表key,可能跟你的不一样,如果不一样,请替换为你的
set sqlyog_reg_key=HKEY_CURRENT_USER\SOFTWARE\{
    
    d58cb4b1-47f3-45cb-a209-f298d0c3f756}

REM 判断注册表是否存在,如果存在删除注册表项
reg query %sqlyog_reg_key%
if %errorlevel%==0 (
  reg delete %sqlyog_reg_key% /f
)

Regarding how to create a scheduled task, please refer to: Creating a scheduled task and executing a Python script under Windows.
Although the article uses Python scripts as an example, the methods are the same. You must learn to draw inferences from one example.

Guess you like

Origin blog.csdn.net/B11050729/article/details/132844131