I'm trying add a key register on windows using ProcessBuilder. Before I tried Runtime.getRuntime.exec() and doesn't work also.
I'm trying this.
ProcessBuilder p = new ProcessBuilder("reg add HKCU\\Software\\Microsoft\\Windows /v mykey /t REG_SZ /d " + "key_value"); try { p.start(); } catch (IOException ex) { Logger.getLogger(Registro.class.getName()).log(Level.SEVERE, null, ex); } The exception is:
GRAVE: null java.io.IOException: Cannot run program "reg add HKCU\Software\Microsoft\Windows /v mykey /t REG_SZ /d key_value": CreateProcess error=2, O sistema não pode encontrar o arquivo especificado at java.lang.ProcessBuilder.start(ProcessBuilder.java:1042) at br.com.iguana.keys.Registro.addChavesRegistro(Registro.java:50) at br.com.iguana.keys.Registro.main(Registro.java:158) Caused by: java.io.IOException: CreateProcess error=2, O sistema não pode encontrar o arquivo especificado at java.lang.ProcessImpl.create(Native Method) at java.lang.ProcessImpl.<init>(ProcessImpl.java:386) at java.lang.ProcessImpl.start(ProcessImpl.java:137) at java.lang.ProcessBuilder.start(ProcessBuilder.java:1023) ... 2 more Any idea ?
regavailable as an executable on your path, as opposed to a shell builtin?regand works. I tryied pass\\Windows\\System32also and nothingreg.exeexist as an executable?