I have a Java program which needs to be a startup program that runs as administrator. It seems that cannot be done without making it a service. I have tried using
HKLM\SYSTEM\CurrentControlSet\Services\Services\MyService. I tried something similar to what Google Updater uses (they use
...\Services\gupdate). The process does not start (or at least it stops right away, which I cannot tell for sure.
I think it is something wrong with how I am using the registry because the service does not show up in
msconfig.exe under the Services tab. Also it doe not show up in the Control Panel "View local services" (Windows 7, found in the Start Menu search for "services")
I tried a much simpler approach found here. I create a
.reg file with these contents.
Windows Registry Editor Version 5.00 [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService] "Description"="My Service starts the Special Process." [HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\MyService\Parameters] "Application"="C:\\Test\\MyProcess.cmd"
I am willing to consider an alternative command-line alternative if necessary, but I like the registry approach because if I tell my installer to add certain registry items, it will automatically remove those items on uninstall.
Is there any reason that above
.reg file would not add an item to
msconfig that is named "MyService"?
The program which I wrote is written in Java. It does not have a GUI interface.