Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to make an exe start at the Windows Startup [duplicate]

Possible Duplicate:
How to put exe file in windows Startup

Suppose I have built an application in C#, Once I install it, I want it to run in the background whenever windows starts up,or you can say a user logs in to his windows account. Is there any way I can do that? Except writing a windows service?

The application basically shows messages when a certain event is triggered Thanks

like image 723
nightWatcher Avatar asked Mar 22 '11 16:03

nightWatcher


People also ask

How do I copy a shortcut to the startup?

Open a File Explorer window to your startup folder (or the "all users" startup folder if you prefer). Then simply drag the new shortcut icon from your desktop to the startup folder. You can also cut and paste it using Ctrl + X and Ctrl + V if you prefer.


2 Answers

Add to shortcut to Windows start-up folder:

Environment.GetFolderPath(Environment.SpecialFolder.Startup) 

Or add to registry, something like this:

RegistryKey add = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); add.SetValue("Your App Name", "\"" + Application.ExecutablePath.ToString() + "\""); 

You can change CurrentUser to LocalMachine if you want it to run with every user. Thanks to Aidiakapi.

like image 142
Badr Hari Avatar answered Sep 29 '22 09:09

Badr Hari


This can be done using the windows registry. I recomend you to check this registry keys.

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 
like image 27
Jonathan Avatar answered Sep 29 '22 08:09

Jonathan