-
StackOverflow 文档
-
nsis 教程
-
服务
-
ServiceState
##=
#= Service::State
#
# USAGE:
# ${Service::State} "NAME" /DISABLEFSR $0 $1
#
# ::State = The service's status is returned.
# NAME = The Service name
# /DISABLEFSR = Disables redirection if x64. Use "" to skip.
# $0 = Return after call | 1 = success
# $1 = '' '' '' | 1 = running
#
# $1 will now hold "1" if running or "0" if not
#
!define Service::State `!insertmacro _Service::State`
!macro _Service::State _SVC _FSR _ERR1 _ERR2
ReadEnvStr $R0 COMSPEC
StrCmpS $Bit 64 0 +4
StrCmp "${_FSR}" /DISABLEFSR 0 +3
ExecDos::Exec /TOSTACK /DISABLEFSR `"$R0" /c "${SC} query "${_SVC}" | find /C "RUNNING""`
Goto +2
ExecDos::Exec /TOSTACK `"$R0" /c "${SC} query "${_SVC}" | find /C "RUNNING""`
Pop ${_ERR1}
Pop ${_ERR2}
!macroend