问题
I'm using InstallForge to create an installer. I'm hoping to create an installer that will autostart on start up for the installed program. I'm thinking the installer can create a shortcut in the Start-Up folder and the program should load on start up.
I've Googled and found a solution but doesn't work when I try it. The solution provided was to use the following values for a created registry entry.
Root Key: HKEY_CURRENT_USER
Sub key: SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Value Name: (whatever name you want the key to be) My Program Name
Value Data: C:\Program Files (x86)\My_Company\My_Software\My_Software.exe
回答1:
Quoted Paths: Did you include quotes around your path in the registry value? "C:\Program Files (x86)\My_Company\My_Software\My_Software.exe"
. I would remove the spaces in the registry value name as well: My_Program_Name
. You can also register the application to run for all users by adding to HKLM
(HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
) instead of HKCU
.
There appears to be different keys for x86 and x64 binaries - at least for per-machine components:
HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
Services & Scheduled Tasks: In my opinion it is generally better to run as a Windows service
if you need to run all the time, or to use scheduled tasks
for things that need to run "every now and then". I prefer those options over the run feature. It all depends what your application is doing. Both scheduled tasks and services can run impersonated - with different user credentials than the currently logged on user (and hence elevated if need be).
AutoRuns: For the record, there is a myriad of ways to run once or launch something on startup as you can study by using the tool AutoRuns to list all the entries on the system that are registered.
回答2:
Assuming that the Run key item is correct in the registry:
The program will not start when the system starts. It will be started when a user logs on. If you want it to start when the system starts, then a service is the usual way to do this.
On UAC systems the program won't just start if it requires elevation. If this is the issue, then your question is the same as Program needing elevation in Startup registry key (windows 7)
来源:https://stackoverflow.com/questions/51777042/install-forge-installer-autostart-installed-program