Windows环境下使用.bat安装和卸载服务

一、Windows环境下使用.bat安装和卸载服务

win7环境

例子中“”Valwell.Dms.HttpService.exe“”为服务程序名称

安装服务

%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\installutil.exe Valwell.Dms.HttpService.exe
Net Start SKMPService
sc config SKMPService start= auto
pause

卸载服务

%SystemRoot%\Microsoft.NET\Framework\v2.0.50727\installutil.exe /u Valwell.Dms.HttpService.exe

 

win8及以上

例子中“”Valwell.Dms.HttpService.exe“”为服务程序名称

安装服务

%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil.exe Valwell.Dms.HttpService.exe
Net Start SKMPService
sc config SKMPService start= auto
pause

卸载服务

%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\installutil.exe /u Valwell.Dms.HttpService.exe

 

注:

1. Install.bat和UnInstall.bat文件和服务程序放在同一目录。

2. 如果解决方案中有多个服务,文件名建议改成这种风格(Service名 + Intall.bat/UnInstall.bat):AppServiceInstall.bat和AppServiceUnInstall.bat

 

二、Windows下用cmd命令安装及卸载服务

       删除服务  sc delete "服务名"

  启动服务     sc start "服务名"


ipconfig 查看电脑IP信息

tasklist 查看运行的程序
taskkill 查看终止程序的格式

shutdown 关闭计算机等操作

msconfig 打开系统配置,可以配置启动项、多操作系统的启动优先级和等待时间
calc 打开计算器
services.msc 打开服务
mstsc 打开远程桌面连接

posted @ 2016-06-30 09:13  十二楼C  阅读(9801)  评论(0编辑  收藏  举报