Click here to Skip to main content
15,909,737 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

I just created a pop up window.Now i want to run it automatically when the windows start up.Kindly tell me how to do that?
Posted

Put your exe in following folder. it will run at every srartup. For test, restart the windows.

C:\Documents and Settings\Administrator\Start Menu\Programs\Startup
 
Share this answer
 
Comments
sreenathpktr 5-Nov-11 8:22am    
I have tried it before posting here...It's not working..
sreenathpktr 5-Nov-11 9:19am    
Hey..it worked now...thanks..
For that you need to create windows service.
Simple Windows Service Sample[^]

How to develop Windows Service in C#[^]
 
Share this answer
 
This line will add a registry entry for autostart:
C#
Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run").SetValue("keyNameForRegistry", "PATH_TO_EXECUTABLE");

And this line will remove the autostart:
C#
Registry.CurrentUser.CreateSubKey(@"Software\Microsoft\Windows\CurrentVersion\Run").DeleteValue("keyNameForRegistry", false);

I believe these should work. I don't have time to test them now. There might be some typos. Dont forget to add, not sure if the both are needed tho.
C#
using Microsoft.Win32;
using System.Reflection;
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900