@if exist "%windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe" goto INSTALL4.0
:INSTALL4.0
@echo ◎ 开始安装服务2.0
@%windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe xx.Service
@echo.
@echo √ 服务安装完成!
@goto Ed
:ERR
@echo.
@echo × 程序运行期间出错,安装过程失败,请重新安装本软件!
@echo off
:Ed
@echo.
@echo 按任意键退出......
@pause>nul
@exit
//***********************************************************************************************
如上,
System.IO.FileNotFoundException:
原因是:
InstallUtil WindowsService1.exe
正确的命令行:
@if exist "%windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe" goto INSTALL4.0
:INSTALL4.0
@echo ◎ 开始安装服务2.0
@%windir%\Microsoft.NET\Framework\v4.0.30319\InstallUtil.exe xx.Service.exe
@echo.
@echo √ 服务安装完成!
@goto Ed
:ERR
@echo.
@echo × 程序运行期间出错,安装过程失败,请重新安装本软件!
@echo off
:Ed
@echo.
@echo 按任意键退出......
@pause>nul
@exit