2016-06-22 1 views
-3

.nsh 파일에 Powershell script을 사용할 수 있습니까?nsis 스크립트를 사용하여 특정 폴더에서 가장 최근에 수정 된 파일을 찾는 방법은 무엇입니까?

+2

지금까지 시도하는 것 :

이 자주 !tempfile!include와 결합 출력은 외부 응용 프로그램으로 작성하세요? 간단한 Google 검색을 통해 설치 프로그램에서 powershell 스크립트를 실행하는 방법에 대한 예제가 NSIS 홈페이지에 표시됩니다. –

답변

0

!system 명령으로 외부 응용 프로그램을 호출 할 수 있습니다.

; 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