Ata
Ata

Reputation: 12544

How do I automatically run an application when the system starts?

how to make application startup without using startup folder , is there any way instead of Windows Service ?

Upvotes: 2

Views: 2171

Answers (4)

Dr TJ
Dr TJ

Reputation: 3356

If you wanna set your application start just for specific user, use this:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

and if u want to run in all users use thisone:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run

Upvotes: 0

0x49D1
0x49D1

Reputation: 8704

You can create key in the registry:

RegistryKey app = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
app.SetValue("name", Application.ExecutablePath.ToString());

This will add it to startup apps for current user.

Upvotes: 3

ducknet
ducknet

Reputation: 1

put it to registry like "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"

Upvotes: 0

Alexej Kubarev
Alexej Kubarev

Reputation: 853

Registry entry could do this.

The Registry keys most often involved with startup have the word "Run" in them somewhere. They are listed below using the abbreviation HKLM for the major key (or "hive") called "HKEY_LOCAL_MACHINE" and HKCU for for the hive "HKEY_CURRENT_USER"

HKLM\Software\Microsoft\Windows\CurrentVersion\Run HKLM\Software\Microsoft\Windows\CurrentVersion\RunOnce HKLM\Software\Microsoft\Windows\CurrentVersion\RunServices HKLM\Software\Microsoft\Windows\CurrentVersion\RunServicesOnce HKCU\Software\Microsoft\Windows\CurrentVersion\Run HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnce HKCU\Software\Microsoft\Windows\CurrentVersion\RunOnceEx

You probably have several items in some of them already. Just add additional items there.

Here is how HKLM\Software\Microsoft\Windows\CurrentVersion\Run might look in Regedit (Run-> type "regedit" -> Enter). The right pane shows a number of programs that will run when this system is started. alt text

Hope this helps :-)

Upvotes: 4

Related Questions