RegEdit to run an .exe at startup as administrator

Gossamer Shadow picture Gossamer Shadow · Mar 3, 2012 · Viewed 38.2k times · Source

I have a program which I wrote in Java using Eclipse and then put into a .jar file. Then, I used launch4j to make an executable from my .jar file and included a .manifest file to cause the executable to run with administrator privileges. I put the executable in my C:\ folder, C:\Prog_1.exe. Then, I went into regEdit and added a String entry under HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run which had Value name: Prog_1, Value: C:\Prog_1.exe.

My question is this, if I click on the executable, it seems to run fine... the little warning box pops up and asks if I want to run the program, I hit yes, it does what I expect it to do. However, if I restart the system, I would expect the program to run at startup due to the edit I made to the registry, but this isn't happening. No warning box pops up asking if I want to run the program and the code is not executed. What am I missing?

Edit: I also tried just adding the executable to the startup folder and that didn't cause it to run at startup either.

I should mention that I'm running Windows 7 Pro. Thank you for any help!

Answer

LSalab picture LSalab · Apr 18, 2012

Just out of curiosity, is your Windows version 64 bit?

If it is, then you must add the registry entry in a different place. I had a similar problem with the UPS monitor shipped with my UPS. It turns out that if you have a 64 bit Windows 7, you have to place your startup registry keys in here:

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Windows\CurrentVersion\Run

This worked like a charm for me, and the annoying UAC dialog comes up as soon as I start a session with any user.