簡體   English   中英

從 nsh 文件 nsis 中檢索變量值

[英]retrieve variable value from nsh file 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

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM