问题
How do I make my executable file start with Windows in Visual Studio's Windows Installation project (MSI setup creator)?
Tried to add registry keys, look into 'Assembly' properties. I have the MSI project compile and it installs fine to the folder but I need it to run
a) After installation is complete b) Every time Windows starts.
Thank you
回答1:
On Scheduled Tasks versus Windows Services. See this previous answer for longer descriptions of the below summary items. I don't use this installer tools, so detailed steps I can't do right now.
Startup Folder: You can use the Windows startup folder
as suggested here - allusers:
C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
C:\Users\<user-name>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
Quick access: Windows logo key + R
=>
shell:startup
.
Windows Service: Windows services can be set to run on boot / system startup.
Scheduled Task: It is possible to launch tasks on every boot using the task scheduler.
AutoRun Registry: You can register something to run on launch in the registry:
HKCU\Software\Microsoft\Windows\CurrentVersion\Run
HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
HKLM\SOFTWARE\WOW6432Node\Microsoft\Windows\CurrentVersion\Run
Drivers: I suppose one can mention drivers as well. They load on startup.
When should I use a scheduled task instead of a Windows Service?
Autoruns.exe: Sysinternals has the tool autoruns.exe which will show you just how many ways there are to start something on system startup:
Links:
- https://www.advancedinstaller.com/user-guide/qa-launch-app-logon.html
- How to Run Programs Automatically When a User Logs On (
Winkey + R
=>
gpedit.msc
)
来源:https://stackoverflow.com/questions/56640799/force-file-to-autostart-with-windows-in-vss-msi-setup