【发布时间】:2016-06-22 09:06:38
【问题描述】:
是否可以在 .nsh 文件中使用 Powershell script 来执行此操作?
【问题讨论】:
-
到目前为止你尝试过什么?一个简单的谷歌搜索会让你进入 NSIS 主页,其中包含如何从安装程序执行 powershell 脚本的示例
标签: powershell nsis
是否可以在 .nsh 文件中使用 Powershell script 来执行此操作?
【问题讨论】:
标签: powershell nsis
您可以使用!system 指令调用外部应用程序。
这通常与!tempfile 和!include 结合使用,以获得外部应用程序写入的输出:
; We need a file in %temp% that the external command can write to.
!tempfile TMPINC
; This !system command tries to find the file in the Windows directory
!system `cd /D %windir% & FOR /F %A IN ('dir /A:-D /T:W /O:D /B') DO @(> "${TMPINC}" echo.!define RECENTMOD "%~fA")`
!include "${TMPINC}"
!delfile "${TMPINC}"
!undef TMPINC
!ifndef RECENTMOD
!error "No files found!"
!endif
Section
File "${RECENTMOD}"
SectionEnd
【讨论】: