[英]How to start the windows application when we starts the computer
How to start the windows application when we starts the computer.当我们启动计算机时,如何启动 windows 应用程序。 In my application I want to update the current date & time in registry.
在我的应用程序中,我想更新注册表中的当前日期和时间。
The easiest way is to add it to the "startup" folder which you can find the Windows button -> All programs.最简单的方法是将其添加到“启动”文件夹中,您可以在该文件夹中找到 Windows 按钮 -> 所有程序。 It might be named differently if you have a localized Windows version.
如果您有本地化的 Windows 版本,它的名称可能会有所不同。
Use the "Run" key in the registry.使用注册表中的“运行”键。
See http://support.microsoft.com/kb/314866请参阅http://support.microsoft.com/kb/314866
You can use the Startup folder, thats easy to handle by your users if they do not want it anymore.您可以使用Startup文件夹,如果您的用户不再需要它,这很容易处理。
Then there ist the Run key in the registry, see Andrew' answer.然后注册表中有Run键,请参阅 Andrew 的回答。
Also you might set up a windows service which does things not interactivly and also when no user is logged in. This service can do a single thing, start up automatic und terminate after finishing its work (it does not need to loop like most services).您也可以设置一个 windows 服务,它不会交互地执行操作,也可以在没有用户登录时执行。该服务可以做一件事情,完成工作后自动启动和终止(它不需要像大多数服务一样循环) .
You can use two easy ways to do this.您可以使用两种简单的方法来做到这一点。
Add to Start up folder添加到启动文件夹
Environment.GetFolderPath(Environment.SpecialFolder.Startup)
Add registry entry添加注册表项
RegistryKey myKey= Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
myKey.SetValue("Your Application Name", "\"" + Application.ExecutablePath.ToString() + "\);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.