微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

从nsh文件nsis检索变量值

如何解决从nsh文件nsis检索变量值

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

当我在nsi文件调用它时,它可以工作。但是我想知道启动服务的返回值(SimpleSC :: StartService“ $ {SVC}”“ $ {Args}”“ $ {Timeout}”,弹出$ 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

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。