Surya sasidhar
Surya sasidhar

Reputation: 30323

How to work with startup in windows application(.net)

i created a small tool in windows application using (.net language C#). i created setup for my tool and also when we click on minimize button it will be in system tray. My requirement is i want to place my tool in start up (start>All Programs>Start up) when i start my system automatically my tool is open this is my requirement please help me thank you.

Upvotes: 0

Views: 525

Answers (3)

Surya sasidhar
Surya sasidhar

Reputation: 30323

go to solution explorer and select the setup folder what u created select any file (project setup) and u can see the two splited windows one is Files system on Target Machine right click on empty space u can get 'add special folder >> user's startup Folder' and u can get a folder then right click and add project output thats all.

Upvotes: 1

RC1140
RC1140

Reputation: 8663

The cleaner way is to copy the exe to the following location

Environment.GetFolderPath(System.Environment.SpecialFolder.Startup)

The only reason I recommend using this Method instead of hardcoding the value , is because the paths can change and trying to pre-empt ever every users move is a waste of time.Should just mention that the method above still returns the same folders as the first answer

Upvotes: 0

RossFabricant
RossFabricant

Reputation: 12492

Just put the EXE you want to run to the correct startup folder. Username is the logged on user. Run cmd, then type echo %username% to find your username.

Windows Vista

c:\Users\[username]\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup

Windows XP/2000

c:\Documents and Settings\[username]\Start Menu\Programs\Startup

Windows NT 4

c:\Winnt\Profiles\[username]\Start Menu\Programs\Startup

Windows 95/98/ME

c:\WINDOWS\Start Menu\Programs\Startup

Upvotes: 0

Related Questions