我想使用Windows命令提示符(而不是Visual Studio命令提示符)安装Windows服务。
我怎么做呢?
我想使用Windows命令提示符(而不是Visual Studio命令提示符)安装Windows服务。
我怎么做呢?
当前回答
安装服务:
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe"
"C:\Services\myservice.exe"
卸载服务:-
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe" -u "C:\Services\myservice.Service.exe"
其他回答
我必须在这篇文章中再补充一点。要安装/卸载64位版本的程序集,应使用64位版本的工具。要安装一个服务,命令应该是:
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe"
"C:\YourFolder\YourService.exe"
而卸载命令应该是:
"C:\Windows\Microsoft.NET\Framework64\v4.0.30319\InstallUtil.exe" -u
"C:\YourFolder\YourService.exe"
以管理员身份打开命令提示符,转到.exe所在的文件夹。 将Exe作为服务安装
D:\YourFolderName\YourExeName /i
卸载时使用“/u”。
以下代码,安装和卸载服务,
打开命令提示符,以管理员身份运行程序,输入以下命令并按enter。
语法
安装
C:\windows\microsoft.net\framework\v4.0.30319>InstallUtil.exe + Your copied path + \your service name + .exe
我们的道路 InstallUtil.exe C: \ MyFirstService \ bin \ \ MyFirstService.exe调试
要卸载
C:\windows\microsoft.net\framework\v4.0.30319>InstallUtil.exe -u + Your copied path + \your service name + .exe
例如:我们的路径InstallUtil.exe -u C:\MyFirstService\bin\Debug\MyFirstService.exe
要获得更多帮助,您可以查看以下链接:示例程序
以管理员身份运行Windows命令提示符 cd C:\Windows\Microsoft.NET\Framework\v4.0.30319\到文件夹 installutil C:\ProjectFolder\bin\Debug\MyProject.exe
卸载方法:installutil /u C:\ProjectFolder\bin\Debug\MyProject.exe
安装服务:
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe"
"C:\Services\myservice.exe"
卸载服务:-
"C:\Windows\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe" -u "C:\Services\myservice.Service.exe"