开发者

How to start the windows application when we starts the computer

How to start the window开发者_Python百科s application when we starts the computer. In my application I want to update the current date & time in registry.


The easiest way is to add it to the "startup" folder which you can find the Windows button -> All programs. It might be named differently if you have a localized Windows version.


Use the "Run" key in the registry.

See http://support.microsoft.com/kb/314866


You can use the Startup folder, thats easy to handle by your users if they do not want it anymore.

Then there ist the Run key in the registry, see Andrew' answer.

Also you might set up a windows service which does things not interactivly and also when no user is logged in. This service can do a single thing, start up automatic und terminate after finishing its work (it does not need to loop like most services).


You can use two easy ways to do this.

Add to Start up folder

Environment.GetFolderPath(Environment.SpecialFolder.Startup) 

Add registry entry

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

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜