如何使在Windows启动一个exe启动 [英] How to make an exe start at the Windows Startup
问题描述
可能重复:结果
的如何把exe文件在Windows启动时
假设我已经建立在C#中的应用程序,一旦我安装它,我希望它在后台运行在Windows启动时,或者你可以在自己的Windows帐户说一个用户登录。有没有什么办法可以做到这一点?除了写一个窗口服务?
Suppose I have built an application in C#, Once I install it, I want it to run in the background whenever windows starts up,or you can say a user logs in to his windows account. Is there any way I can do that? Except writing a windows service?
应用程序基本上显示了当某个事件被触发
由于消息
The application basically shows messages when a certain event is triggered Thanks
推荐答案
添加到快捷方式到Windows启动文件夹:
Add to shortcut to Windows start-up folder:
Environment.GetFolderPath(Environment.SpecialFolder.Startup)
或添加到注册表中,这样的事情:
Or add to registry, something like this:
RegistryKey add = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true);
add.SetValue("Your App Name", "\"" + Application.ExecutablePath.ToString() + "\"");
您可以更改的currentUser为LOCALMACHINE,如果你想让它与每一个用户运行。感谢Aidiakapi。
You can change CurrentUser to LocalMachine if you want it to run with every user. Thanks to Aidiakapi.
这篇关于如何使在Windows启动一个exe启动的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!