From cc6512c57bb13fb217cc29291f004679a8824570 Mon Sep 17 00:00:00 2001 From: reksarka Date: Thu, 26 Oct 2023 05:10:59 +0300 Subject: [PATCH] FIX: prevents the use of third-party `find` --- sdk/check-installers.bat | 11 ++++++++--- sdk/extract-installers.bat | 4 +--- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/sdk/check-installers.bat b/sdk/check-installers.bat index cda07a1..96627db 100644 --- a/sdk/check-installers.bat +++ b/sdk/check-installers.bat @@ -1,12 +1,17 @@ @echo off - setlocal set destination=%~1 if not exist "%destination%" exit /b 1 -set count_files=dir /b "%destination%" ^^^| find /c /i +rem The %PATH% to system `find` may be overwritten by third-party utils. +set find=%SystemRoot%\System32\find.exe +if not exist "%find%" ( + echo [ERR][%~n0] System `find` not found! + exit /b 2 +) +set count_files=dir /b "%destination%" ^^^| "%find%" /c /i for /f %%i in ('%count_files% ".msi"') do ( for /f %%j in ('%count_files% ".cab"') do ( if %%i GTR 0 ( @@ -16,6 +21,6 @@ for /f %%i in ('%count_files% ".msi"') do ( ) else echo [WARN][%~n0] MSI installers not found. ) ) -exit /b 2 +exit /b 3 endlocal diff --git a/sdk/extract-installers.bat b/sdk/extract-installers.bat index 5bcbd60..6dbe010 100644 --- a/sdk/extract-installers.bat +++ b/sdk/extract-installers.bat @@ -1,9 +1,7 @@ @echo off rem -------------------------------------------------------------------------- -rem Extracts the Windows SDK Installers from the [iso] to the [installers] dir. -rem -rem Using: +rem Extracts the Windows SDK Installers from the [iso] to the [installers] dir: rem rem extract-installers [iso] [installers] rem --------------------------------------------------------------------------