Ok so I have a batch file named tc1.bat that has the following line
start java -jar \\master\TestClient\dist\TestClient.jar
I want to be able to run tc1.bat (manually by double clicking on it, which starts TestClient.jar and I want TestClient to be able to put that bat file into the RunOnce key in the windows registry. So basically a program that can put itself into the computer's startup routine for the next startup.
I need to be able to get the relative/current path when the app runs because I won't always know where the batch file gets run from. Below is some pseudo-code
public static main {
getCurrentDirectory();
addToRegistry("HKLM/Software/microsoft/windows/currentversion/runonce"
"patchToCurrentDirectory\tc1.bat");
}
So the end result is that I run the batch file, lets say from the desktop, it will run the program that will insert into the runOnce to run the bat file that is on the desktop that originally ran the program.
To shed some light on what I'm trying to do, I have a program that will be able to shutdown or restart the PC. I want to be able to have an option to say "restart this PC but run the program after the PC restarts".
*Alternatively, If I could actually just write the patch directly to the JAR file in the runOnce without having to use a batch file, that would be even better. I tried putting start java -jar etc... into the runOnce but it doesnt work.