0
我想分解代碼snippit我已經遍佈我的NSIS安裝程序。該片段如下:如何使這個功能在NSIS中實際工作?
nsExec::ExecToStack 'Dism.exe /Online /Enable-Feature /FeatureName:NetFx3'
Pop $0
${If} $0 != 0
Pop $0
Push ".NET 3.5 failed to install: $\n$0"
Call DetailPrintTS
StrCpy $Errors "$Errors Errors From .NET 3.5 install:$\n$0$\n$\n"
${EndIf}
所以我想這個因素,以類似:
Function LoggedExec
Pop $0
Pop $1
nsExec::ExecToStack $0
Pop $0
${If} $0 != 0
Pop $0
Push "$1 failed to install: $\n$0"
Call DetailPrintTS
StrCpy $Errors "$Errors Errors From $1 install:$\n$0$\n$\n"
${EndIf}
FunctionEnd
,然後調用它,如下所示:
Push 'Dism.exe /Online /Enable-Feature /FeatureName:NetFx3'
Push '.NET 3.5'
Call LoggedExec
注意DetailPrintTS是我製作的另一個功能包括DetailPrint中的時間戳:
Function DetailPrintTS
Pop $7
${GetTime} "" "L" $0 $1 $2 $3 $4 $5 $6
DetailPrint "$4:$5:$6 -- $7$\n"
FunctionEnd
那麼,是什麼問題?注意,從你的代碼片段中,如果你按下命令然後輸入日誌文本,你需要以相反的順序彈出'pop $ 1'然後'pop $ 0' – Seki 2013-03-14 21:35:33
我想你只是回答了我的問題... – 2013-03-15 12:46:25
我可以讓它成爲真正的答案然後:) – Seki 2013-03-15 13:16:21