使用InstallUtil对Windows服务进行安装与卸载

关于Visual Studio 2012中使用InstallUtil对Windows服务进行安装与卸载的文章,在MSDN中的http://msdn.microsoft.com/en-us/library/sd8zc8ha.aspx 有介绍  :

  1. 点击左下角的开始按钮,按如下顺序“开始 - Visual Studio 2012 - Visual Studio Tools - Developer Command Prompt  for VS2012”,打开一个命令窗口 
  2.   runas /user:Administrator cmd   
  3.  提示输入该用户名的密码,按要求输入( 输入的密码无任何显示)
  4. 密码输入正确后,新开一个cmd窗口,标题是cmd(作为Myname运行)
  5.  输入命令: installutil.exe Myservice.exe 如果安装成功,则直接显示命令提示符,没有任何信息;如果安装不成功,则会有信息出现 
  6.  管理 -  服务 ,可以找到服务“Myservice” 点击启动 
C:windowssystem32>runas /user:cn-hr@outlook.com cmd
输入 cn-hr@outlook.com 的密码:
试图将 cmd 作为用户 "cn-hr@outlook.com" 启动...

2、InstallUtil.exe可以单独运行, 

卸载Windows服务,使用/u参数即可。命令为:

installutil /u Myservice.exe

 1  runas /user:cn-hr@outlook.com cmd
 2 
 3 C:WindowsWinSxSamd64_installutil_b03f5f7f11d50a3a_6.3.9600.20708_none_3801968eea5f295eInstallUtil.exe D:DevelopmentIMLanMsg4publicLanMsgServiceinLanMsgService.exe
 4 
 5 
 6 
 7 C:WindowsWinSxSx86_installutil_b03f5f7f11d50a3a_6.3.9600.16384_none_9684d201e52c559fInstallUtil.exe D:DevelopmentIMLanMsg4publicLanMsgServiceinLanMsgService.exe
 8 
 9  "C:WindowsMicrosoft.NETFrameworkv4.0.30319InstallUtil.exe D:DevelopmentIMLanMsg4publicLanMsgServiceinLanMsgService.exe
10 
11 
12 "C:WindowsMicrosoft.NETFramework64v4.0.30319InstallUtil.exe D:DevelopmentIMLanMsg4publicLanMsgServiceinLanMsgService.exe
13 
14 "C:WindowsMicrosoft.NETFramework64v2.0.50727InstallUtil.exe D:DevelopmentIMLanMsg4publicLanMsgServiceinLanMsgService.exe
15 
16 "C:WindowsMicrosoft.NETFrameworkv2.0.50727InstallUtil.exe D:DevelopmentIMLanMsg4publicLanMsgServiceinLanMsgService.exe
17 
18 C:WindowsMicrosoft.NETFrameworkv2.0.50727InstallUtil.exe D:DevelopmentIMOurMsg2.3.5.6ServerBinOurMsgService.exe"
19 
20 
21 
22 C:WindowsMicrosoft.NETFrameworkv2.0.50727InstallUtil.exe D:DevelopmentIMOurMsg2.3.5.6ServerBinOurMsgServer.exe"
原文地址:https://www.cnblogs.com/endv/p/4623396.html