一、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 打開遠程桌面連接