开发者

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 cl开发者_StackOverflowick 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.


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.


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


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

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜