[英]How to work with startup in windows application(.net)
i created a small tool in windows application using (.net language C#). 我使用(.net语言C#)在Windows应用程序中创建了一个小工具。 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.
我的要求是我想在自动启动系统时将工具置于启动状态(启动>所有程序>启动),这是我的要求,请帮助我。
转到解决方案资源管理器并选择您创建的设置文件夹,选择任何文件(项目设置),您会看到两个分割的窗口,一个是目标计算机上的文件系统,右键单击空白空间,您可以得到“添加特殊文件夹>>用户启动”文件夹”,您可以得到一个文件夹,然后右键单击并添加所有项目输出。
Just put the EXE you want to run to the correct startup folder. 只需将要运行的EXE放到正确的启动文件夹中即可。 Username is the logged on user.
用户名是登录的用户。 Run cmd, then type
echo %username%
to find your username. 运行cmd,然后键入
echo %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 较干净的方法是将exe复制到以下位置
Environment.GetFolderPath(System.Environment.SpecialFolder.Startup) 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 我建议使用此方法而不是对value进行硬编码的唯一原因是,因为路径可能会更改,并且试图抢占每个用户的移动都是在浪费时间。仅需提一下,上述方法仍会返回与第一个答案
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.