为什么我不断收到无法运行程序错误?

时间:2021-02-15 12:46:30

标签: command registry uninstallation

我想为我的软件制作一个卸载程序,我希望它只删除文件和注册表,但是,我得到了这个,我尝试添加一个空格,检查语法,但这些都不起作用,这是一些代码,错误在消息下方。

    public static void main(String[] args) throws IOException {
        Runtime.getRuntime().exec("DEL " + query(WinReg.HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{15100000-0000-0409924A46C310}", "InstallLocation") + "\\yes i already checked the name, also i dont feel like sharing the name.");
        Advapi32Util.registryDeleteKey(WinReg.HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion\\Uninstall\\{15100000-0000-0409924A46C310}");
    }

    private static String query(WinReg.HKEY Hub, String loc, String Value) throws IOException {
        return Advapi32Util.registryGetStringValue(Hub, loc, Value);
        }
    }
Exception in thread "main" java.io.IOException: Cannot run program "DEL": CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at login2.s.main(s.java:10)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    ... 5 more

0 个答案:

没有答案