第一种 - 安装服务时自定义服务名称:
(注意 binpath= 和路径之间的那个空格)
sc create 服务名称 binpath= "D:Service.exe" displayname= "显示名称" depend= Tcpip start= auto (启动类型)
第二种 - 安装目录服务:
C:WindowsMicrosoft.NETFrameworkv4.0.30319 下 2.0也有
InstallUtil.exe D:Service.exe
卸载服务
InstallUtil.exe /u D:Service.exe