.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
Sign In
Win Surprise Gifts!!!

Post New Resource Bookmark and Share   

How to Run Our Windows/Console Application during Windows Startup?

Posted By:Sajid P K       Posted Date: October 12, 2010    Points: 50    Category:    URL: http://www.dotnetspark.com  

in this Article you will learn how to run our application during Windows Startup with the help of C# and the .NET Framework.

Logic behind this is windows automatically starts all application listed under SOFTWARE\Microsoft\Windows\CurrentVersion\Run registry key while windows start up

See the image below.

That means Following programs automatically start while windows startup

·  C:\WINDOWS\system32\ctfmon.exe

·  E:\gwpl\gwpl62.exe

·  C:\xyz\OurApplication.exe


So only thing we have do here is add a string value under this key and update the data field with application path. 

And call the follwing mehod  at the time of installtion or first time application runs.


public static void  Windowsstartup()
   rkApp = Registry.LocalMachine.OpenSubKey("SOFTWARE\Microsoft\Windows\CurrentVersion\Run", true);    

  if (rkApp.GetValue("OurApplication ") == null) 
          rkApp.SetValue("OurApplication ",Application.ExecutablePath.ToString());  





Further Readings:


No response found. Be the first to respond this post

Post Comment

You must Sign In To post reply

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend