@echo.
@if exist "%windir%Microsoft.NETFrameworkv4.0.30319InstallUtil.exe" goto INSTALL4.0
:INSTALL4.0
@echo ◎ 开始安装服务2.0
@%windir%Microsoft.NETFrameworkv4.0.30319InstallUtil.exe xx.Service
@echo.
@echo √ 服务安装完成!
@goto Ed
:ERR
@echo.
@echo × 程序运行期间出错,安装过程失败,请重新安装本软件!
@echo off
:Ed
@echo.
@echo 按任意键退出......
@pause>nul
@exit
@if exist "%windir%Microsoft.NETFrameworkv4.0.30319InstallUtil.exe" goto INSTALL4.0
:INSTALL4.0
@echo ◎ 开始安装服务2.0
@%windir%Microsoft.NETFrameworkv4.0.30319InstallUtil.exe xx.Service
@echo.
@echo √ 服务安装完成!
@goto Ed
:ERR
@echo.
@echo × 程序运行期间出错,安装过程失败,请重新安装本软件!
@echo off
:Ed
@echo.
@echo 按任意键退出......
@pause>nul
@exit
//***********************************************************************************************
如上,
在初始化安装时发生异常:
System.IO.FileNotFoundException:
System.IO.FileNotFoundException:
"file:///D: estService"未能加载文件或程序集。系统找不到指定文件。
原因是:
InstallUtil WindowsService1.exe
把 “.exe" 加上
正确的命令行:
@echo.
@if exist "%windir%Microsoft.NETFrameworkv4.0.30319InstallUtil.exe" goto INSTALL4.0
:INSTALL4.0
@echo ◎ 开始安装服务2.0
@%windir%Microsoft.NETFrameworkv4.0.30319InstallUtil.exe xx.Service.exe
@echo.
@echo √ 服务安装完成!
@goto Ed
:ERR
@echo.
@echo × 程序运行期间出错,安装过程失败,请重新安装本软件!
@echo off
:Ed
@echo.
@echo 按任意键退出......
@pause>nul
@exit
@if exist "%windir%Microsoft.NETFrameworkv4.0.30319InstallUtil.exe" goto INSTALL4.0
:INSTALL4.0
@echo ◎ 开始安装服务2.0
@%windir%Microsoft.NETFrameworkv4.0.30319InstallUtil.exe xx.Service.exe
@echo.
@echo √ 服务安装完成!
@goto Ed
:ERR
@echo.
@echo × 程序运行期间出错,安装过程失败,请重新安装本软件!
@echo off
:Ed
@echo.
@echo 按任意键退出......
@pause>nul
@exit