服务安装程序命令行 [英] Service installer command line

查看:83
本文介绍了服务安装程序命令行的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用ManagedInstallerClassInstaller安装Windows服务时,如何为该服务设置启动命令行参数?

即可执行文件的路径="c:\ service.exe -p param1 -q param2"

When installing a windows service with ManagedInstallerClass and Installer how can you set the start-up command line arguments to the service?

i.e. Path to executable = "c:\service.exe -p param1 -q param2"

推荐答案

服务由服务主机运行,由服务管理器启动.没有争论.您必须在安装过程中或使用独立配置应用程序将这些参数存储在某个地方(例如注册表),然后在服务中读取它们.

更新:我已经做过一些研究,看来您可以按预期传递参数.请参阅以下内容: http://www.c-sharpcorner.com/UploadFile/ankithakur/Passing_parameters_tos_Windows_Services10062006000204AM .aspx [ ^ ],但我认为HKLM中的专用注册表项更干净.
A service is ran by the service host, started by the service manager. There are no arguments. You have to store these parameters somewhere (registry for example) during installation, or using a standalone configuration application - and read them in the service.

Update: I have done some research, and it seems, that you can pass arguments, as you intend. See this: http://www.c-sharpcorner.com/UploadFile/ankithakur/Passing_parameters_to_Windows_Services10062006000204AM/Passing_parameters_to_Windows_Services.aspx[^], but I think that dedicated registry key in HKLM is cleaner.


这篇关于服务安装程序命令行的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆