从nsh文件nsis中检索变量值



我正在使用nsis创建安装程序。我已经使用SIMPLE SC创建了.nsh文件来启动、停止和删除服务。我已经为此使用了宏。

当我在nsi文件中调用它时,它就起作用了。但是我想知道启动服务的返回值(SimpleSC::StartService"${SVC}"${Args}"${Timeout}",Pop$0(。如何在nsis文件中检索nsh文件的$0值

如果您有一些返回结果的辅助宏,您可以将结果留在堆栈上:

!macro DoSomething
Push $0
Push $1
Push "Pretend that this is a function that does something and puts the result on the stack"
Pop $0 ; Result we want to return
Pop $1
Exch $0
!macroend
!insertmacro DoSomething
Pop $0
MessageBox MB_OK $0

或者将其作为宏的一部分存储在寄存器中:

!macro DoSomething outvar
Push $0
Push $1
Push "Pretend that this is a function that does something and puts the result on the stack"
Pop $0 ; Result we want to return
Pop $1
Exch $0
Pop ${outvar}
!macroend
!insertmacro DoSomething $0
MessageBox MB_OK $0

最新更新