windows - Run java from a batch file and then copy batch file to runonce key -


ok have batch file named tc1.bat has following line

start java -jar \\master\testclient\dist\testclient.jar 

i want able run tc1.bat (manually double clicking on it, starts testclient.jar , want testclient able put bat file runonce key in windows registry. program can put computer's startup routine next startup.

i need able relative/current path when app runs because won't know batch file gets run from. below pseudo-code

public static main {     getcurrentdirectory();     addtoregistry("hklm/software/microsoft/windows/currentversion/runonce"          "patchtocurrentdirectory\tc1.bat"); } 

so end result run batch file, lets desktop, run program insert runonce run bat file on desktop ran program.

to shed light on i'm trying do, have program able shutdown or restart pc. want able have option "restart pc run program after pc restarts".

*alternatively, if write patch directly jar file in runonce without having use batch file, better. tried putting start java -jar etc... runonce doesnt work.


Comments