在构建 nsis 安装程序时捕获 cmd 输出

Catch cmd output while building nsis installer

如何在编译 NSIS 安装程序时从 cmd 应用程序获取输出?

CMD 应用返回字符串。

我正在尝试,但在消息框中得到 0。

!system ".\cmdapp.exe" MYOUTPUT
MessageBox MB_ICONINFORMATION "${MYOUTPUT}"

0 有退出代码。您需要手动将输出重定向到某处。

Section
!tempfile stdoutfile
!system 'dir "$%windir%\e*.exe" > "${stdoutfile}"'
!define /file stdout "${stdoutfile}"
!delfile "${stdoutfile}"
MessageBox mb_ok "${stdout}"
SectionEnd