原创

解决navicat16试用期过期问题

windows bat 脚本

@echo off
reg delete "HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium\Registration16XCS" /f
reg delete "HKEY_CURRENT_USER\Software\PremiumSoft\NavicatPremium\Update" /f
reg query "HKEY_CURRENT_USER\Software\Classes\CLSID" > temp.txt
for /f "tokens=*" %%i in (temp.txt) do (
    reg delete "%%i\Info" /f
)
del temp.txt
echo 删除注册表成功,重新开始试用Navicat
pause

java 代码

import java.io.*;
import java.util.ArrayList;
import java.util.List;

/**
 * Navicat16试用期到期后,运行此类,重新开始试用
 */
class Navicat {
    public static void main(String[] args) throws IOException {
        Runtime.getRuntime().exec(new String[]{"reg", "delete", "HKEY_CURRENT_USER\\Software\\PremiumSoft\\NavicatPremium\\Registration16XCS", "/f"});
        Runtime.getRuntime().exec(new String[]{"reg","delete","HKEY_CURRENT_USER\\Software\\PremiumSoft\\NavicatPremium\\Update","/f"});
        Process process = Runtime.getRuntime().exec(new String[]{"reg","query","HKEY_CURRENT_USER\\Software\\Classes\\CLSID"});
        List<String> keys = new ArrayList<>();
        try (InputStream inputStream = process.getInputStream();
             InputStreamReader inputStreamReader = new InputStreamReader(inputStream);
             BufferedReader reader = new BufferedReader(inputStreamReader)) {
            String line;
            while ((line = reader.readLine()) != null) {
                keys.add(line);
            }
        } catch (IOException e) {
            e.printStackTrace();
        }
        for (String key : keys){
            Runtime.getRuntime().exec(new String[]{"reg","delete",key + "\\Info","/f"});
        }
        System.out.println("删除注册表成功,重新开始试用navicat");
    }
}
正文到此结束