Auto start .NET application on system reboot
Inorder to start you .net application whenever system starts, you need to set the application path in the registry. In registry, there is a special location called ‘Run’ under SOFTWARE\Microsoft\Windows\CurrentVersion\. You need to make an entry in the ‘Run’ key for starting your application on every reboot.
The following code snippet will give a quick idea on setting entry in the ‘Run’ key,
internal void SetStartUp()
string path = System.IO.Path.GetDirectoryName(
System.Reflection.Assembly.GetExecutingAssembly().Location) + “\\mygametray.exe“;
var rkApp = Registry.LocalMachine.OpenSubKey(@”SOFTWARE\Microsoft\Windows\CurrentVersion\Run”, true);
if (rkApp.GetValue(“mygametray”) == null)
rkApp.SetValue(“mygametray “, ‘”‘ + path + ‘”‘);
You need to perform this action while performing installation.
No comments yet.