为什么我在使用bat文件安装/卸载Windows服务时出错? [英] Why I am getting the error on installing/ uninstalling windows service using bat file?
问题描述
我正在通过Bat文件安装Windows服务。我甚至以管理员身份运行bat文件。机器中也有必需的dot net框架。操作系统是Windows 7 64位。以下是在3.5框架中开发的
但在安装时我收到以下错误
I am installing the windows service via Bat file. I even ran the bat file as administrator.The required dot net framework is also there in the machine. The OS is windows 7 64 bit. The below is developed in 3.5 framework
But on installation I am getting the below error
System.Security.SecurityException: The source was not found, but some or all event logs could not be searched. Inaccessible logs: Security
以下是bat文件中的内容
Below is the content in bat file
@echo off
set SERVICE_HOME="D:\New folder (5)"
set SERVICE_EXE=PDF_Data_Tool.exe
REM the following directory is for .NET 1.1, your mileage may vary
set INSTALL_UTIL_HOME=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\
set PATH=%PATH%;%INSTALL_UTIL_HOME%
cd %SERVICE_HOME%
echo Installing Service...
installutil %SERVICE_EXE%
echo Done.
PAUSE
我尝试过:
尝试通过bat文件以管理员身份安装和卸载Windows服务/而不是管理员
@echo off
设置SERVICE_HOME =D:\New文件夹(5)
设置SERVICE_EXE = PDF_Data_Tool.exe
REM以下目录适用于.NET 1.1,您的里程可能不一样
设置INSTALL_UTIL_HOME = C:\ WINDOWS \ Mesrosoft.NET \ Framework \v2.0.50727 \
set PATH =%PATH%;%INSTALL_UTIL_HOME%
cd%SERVICE_HOME%
echo安装服务...
installutil%SERVICE_EXE%
echo Done。
PAUSE
What I have tried:
Tried installing and uninstalling of windows service via the bat file as administrator/ and not as administrator
@echo off
set SERVICE_HOME="D:\New folder (5)"
set SERVICE_EXE=PDF_Data_Tool.exe
REM the following directory is for .NET 1.1, your mileage may vary
set INSTALL_UTIL_HOME=C:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\
set PATH=%PATH%;%INSTALL_UTIL_HOME%
cd %SERVICE_HOME%
echo Installing Service...
installutil %SERVICE_EXE%
echo Done.
PAUSE
推荐答案
installutil -i %SERVICE_EXE%安装服务和
installutil -u %SERVICE_EXE%来安装服务
it is
installutil -i %SERVICE_EXE% to install a service and
installutil -u %SERVICE_EXE% to UNinstall a service
这篇关于为什么我在使用bat文件安装/卸载Windows服务时出错?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!