title: Creating Windows Startup Services via REG or Command Line
body: <p>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 <code>HKLM\SYSTEM\CurrentControlSet\Services\Services\MyService</code>. I tried something similar to what Google Updater uses (they use <code>...\Services\gupdate</code>). The process does not start (or at least it stops right away, which I cannot tell for sure.</p>
  
  <p>I think it is something wrong with how I am using the registry because the service does not show up in <code>msconfig.exe</code> 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")</p>
  
  <p>I tried a <a href="http://www.vistax64.com/net-general/180428-creating-windows-service.html" rel="nofollow">much simpler approach found here</a>. I create a <code>.reg</code> file with these contents.</p>
  
  <pre><code>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"
  </code></pre>
  
  <p>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.</p>
  
  <p>Is there any reason that above <code>.reg</code> file would not add an item to <code>msconfig</code> that is named "MyService"?</p>
  
  <p>The program which I wrote is written in Java. It does not have a GUI interface.</p>