I have done my .java file that changes registry data. But I am getting "illegal escape character" error on the line where Runtime.getRuntime().exec
exists. Where is my mistake ?
import java.util.*;
import java.applet.Applet;
import java.awt.*;
class test {
public static void main(String args[]) {
try {
Runtime.getRuntime().exec("REG ADD 'HKCU\Software\Microsoft\Internet Explorer\Main' /V 'Start Page' /D 'http://www.stackoverflow.com/' /F");
} catch (Exception e) {
System.out.println("Error ocured!");
}
}
}
You need to escape the backslashes used in your path.
String windowsPath = "\\Users\\FunkyGuy\\My Documents\\Hello.txt";
You need to escape \
with another \
, so replace \
with \\
in your input string.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With