如何在启动时运行程序? [英] How to run a program at startup?
本文介绍了如何在启动时运行程序?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何以c#编码启动系统后如何使软件自动运行?
How to make the software run automatically after starting the system in c# coding?
推荐答案
有几种方法
1)在启动部分为您的应用程序设置一个快捷方式.
2)允许您的应用程序从Windows服务加载.
There are few ways to this
1) Place a short cut to your application in the startup section.
2) Allow your application to load from a windows service.
Abhinav S给出的答案很好,这是使用注册表的方法:
Windows程序自动启动位置 [
The answer given by Abhinav S works fine, and here is how to do it using the registry:
Windows Program Automatic Startup Locations[^]
Regards
Espen Harlinn
首先,编写Windows Service是一个不错的选择.与常规应用程序相比,它具有重要的优势,但也更加难以开发和调试.
对于所有其他方式,我有另一种更全面的方法,我发现它非常可靠.您可以在名为AutoRuns
:
的SysInternals应用程序之后找到所有不同的方法来注册应用程序以一次或定期进行加载.
1)转到SysInternals网站: http://technet.microsoft.com/en-us/sysinternals [ ^ ].
2)下载SysInternals套件: http://download.sysinternals.com/Files/SysinternalsSuite.zip [ ^ ];您还可以下载单独的应用程序,但是还有更多有用的信息,请阅读实用程序索引: http://technet.microsoft. com/en-us/sysinternals/bb545027 [ ^ ].
3)解压并运行AutoRuns
,阅读帮助并查看树的顶级项目:它们显示何时可以安装应用程序.
4)激活上下文菜单,然后选择跳转到";它将在所选项目上打开Regedit
.
5)编写安装应用程序,它将安装程序的路径和参数写入注册表中的正确位置.
祝你好运,
—SA
First of all, writing a Windows Service is a serious option. It gives important benefits over regular applications, but also more difficult to develop and debug.
For all other ways, I have a different, more comprehensive method which I find very robust. You can find all different ways to register application for loading once or on regular basis following SysInternals application calledAutoRuns
:
1) Go to SysInternals site: http://technet.microsoft.com/en-us/sysinternals[^].
2) Download SysInternals Suit: http://download.sysinternals.com/Files/SysinternalsSuite.zip[^]; you can also download separate applications, but there are more useful things, read utilities Index: http://technet.microsoft.com/en-us/sysinternals/bb545027[^].
3) Unpack and runAutoRuns
, read it help and look at the top-level items of the tree: they show when you can install your applications.
4) Activate context menu and select "Jump To"; it will openRegedit
on a selected item.
5) Write installation application which writes the path to your application and parameters in a right place in the Registry.
Good luck,
—SA
这篇关于如何在启动时运行程序?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文