如何使应用程序启动,而无需使用启动文件夹,有什么办法,而不是Windows服务?
您可以在注册表中创建密钥:
RegistryKey app = Registry.CurrentUser.OpenSubKey("SOFTWARE\\Microsoft\\Windows\\CurrentVersion\\Run", true); app.SetValue("name", Application.ExecutablePath.ToString());
这会将其添加到当前用户的启动应用程序。
注册表项可以做到这一点。
大多数涉及到启动的注册表项在某处都有“运行”一词。 下面列出了使用称为“HKEY_LOCAL_MACHINE”的主键(或“hive”)的缩写HKLM和用于配置单元“HKEY_CURRENT_USER”的HKCU
HKLM \ Software \ Microsoft \ Windows \ CurrentVersion \ Run HKLM \ Software \ Microsoft \ Windows \ CurrentVersion \ RunOnce HKLM \ Software \ Microsoft \ Windows \ CurrentVersion \ RunServices HKLM \ Software \ Microsoft \ Windows \ CurrentVersion \ RunServicesOnce HKCU \ Software \ Microsoft \ Windows \ CurrentVersion \ Run HKCU \ Software \ Microsoft \ Windows \ CurrentVersion \ RunOnce HKCU \ Software \ Microsoft \ Windows \ CurrentVersion \ RunOnceEx
其中一些可能已经有几个项目了。 在那里添加额外的项目。
以下是HKLM \ Software \ Microsoft \ Windows \ CurrentVersion \ Run可能在Regedit(Run->键入“regedit” – > Enter)中查找的方式。 右窗格显示了许多程序,当这个系统启动时将运行。
希望这可以帮助 :-)
把它放到注册表中,例如“HKEY_LOCAL_MACHINE \ SOFTWARE \ Microsoft \ Windows \ CurrentVersion \ Run”
如果您想为特定用户开始设置应用程序,请使用以下命令:
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Run
如果你想运行在所有用户使用thisone:
HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run