From ddec4c652095c56b80eb242333970c2cc66f290f Mon Sep 17 00:00:00 2001 From: PowerWordTree Date: Sat, 30 Dec 2023 20:28:10 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8F=98=E9=87=8F=E5=89=8D=E5=8A=A0`=5F`?= =?UTF-8?q?=E5=89=8D=E7=BC=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ScriptDependents.cmd | 37 ++++++++++++++++++------------------- 1 file changed, 18 insertions(+), 19 deletions(-) diff --git a/ScriptDependents.cmd b/ScriptDependents.cmd index ddd048d..0528cfa 100644 --- a/ScriptDependents.cmd +++ b/ScriptDependents.cmd @@ -1,6 +1,6 @@ ::获取脚本依赖 ::@author FB -::@version 1.1.0 +::@version 1.1.1 ::Bin:Dumpbin.exe:: ::Bin:Link.exe:: @@ -10,17 +10,16 @@ ::初始化环境 @ECHO OFF SETLOCAL +SET "PATH=%~dp0Bin;%~dp0Script;%PATH%" +SET "_EXIT_CODE=0" CD /D "%~dp0" -SET "PATH=%CD%\Bin;%CD%\Script;%PATH%" -SET "EXIT_CODE=0" ::读取配置 -CALL Object.Destroy.CMD "CONFIG" -CALL Config.FileRead.CMD "CONFIG" "%~n0.ini" +CALL Config.FileRead.CMD "_CONFIG" "%~n0.ini" ::初始化配置 -FOR /F "tokens=1,* usebackq delims==" %%A IN (`SET "CONFIG." 2^>NUL`) DO ( +FOR /F "tokens=1,* usebackq delims==" %%A IN (`SET "_CONFIG." 2^>NUL`) DO ( CALL SET "%%~A=%%~B" IF /I "%%~xA" == ".DST" ( - IF /I "%CONFIG.CLEAN%" == "TRUE" ( + IF /I "%_CONFIG.CLEAN%" == "TRUE" ( CALL RMDIR /Q /S "%%~B" 1>NUL 2>&1 ) CALL MKDIR "%%~B" 1>NUL 2>&1 @@ -30,7 +29,7 @@ FOR /F "tokens=1,* usebackq delims==" %%A IN (`SET "CONFIG." 2^>NUL`) DO ( FOR %%A IN (%*) DO ( CALL :SCRIPT "%%~A" ) -EXIT /B %EXIT_CODE% +EXIT /B %_EXIT_CODE% :::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::: @@ -39,19 +38,19 @@ EXIT /B %EXIT_CODE% FOR /F "tokens=1,2 usebackq delims=#/;: " %%A IN ( `TYPE "%~1" ^| FINDSTR "::[^:][^:]*:[^:][^:]*::"` ) DO IF /I "%%~A" == "Bin" ( - CALL :COPY_BIN "%%~B" && CALL :BIN "%CONFIG.BIN.DST%\%%~B" || SET /A "EXIT_CODE+=1" + CALL :COPY_BIN "%%~B" && CALL :BIN "%_CONFIG.BIN.DST%\%%~B" || SET /A "_EXIT_CODE+=1" ) ELSE IF /I "%%~A" == "Script" ( - CALL :COPY_SCRIPT "%%~B" && CALL :SCRIPT "%CONFIG.SCRIPT.DST%\%%~B" || SET /A "EXIT_CODE+=1" + CALL :COPY_SCRIPT "%%~B" && CALL :SCRIPT "%_CONFIG.SCRIPT.DST%\%%~B" || SET /A "_EXIT_CODE+=1" ) ELSE IF /I "%%~A" == "Other" ( - CALL :COPY_OTHER "%%~B" || SET /A "EXIT_CODE+=1" + CALL :COPY_OTHER "%%~B" || SET /A "_EXIT_CODE+=1" ) EXIT /B ::复制Script文件 :COPY_SCRIPT -IF NOT EXIST "%CONFIG.SCRIPT.DST%\%~1" ( +IF NOT EXIST "%_CONFIG.SCRIPT.DST%\%~1" ( ECHO %~1 - COPY "%~$CONFIG.SCRIPT.SRC:1" "%CONFIG.SCRIPT.DST%\%~1" + COPY "%~$_CONFIG.SCRIPT.SRC:1" "%_CONFIG.SCRIPT.DST%\%~1" EXIT /B ) EXIT /B 1 @@ -60,25 +59,25 @@ EXIT /B 1 :BIN FOR /F "tokens=* usebackq" %%A IN ( `Dumpbin.exe /DEPENDENTS "%~1" ^| FINDSTR /I /R /C:"^ [^ ].*\.DLL$"` -) DO IF EXIST "%%~$CONFIG.BIN.SRC:A" ( - CALL :COPY_BIN "%%~A" && CALL :BIN "%CONFIG.BIN.DST%\%%~A" || SET /A "EXIT_CODE+=1" +) DO IF EXIST "%%~$_CONFIG.BIN.SRC:A" ( + CALL :COPY_BIN "%%~A" && CALL :BIN "%_CONFIG.BIN.DST%\%%~A" || SET /A "_EXIT_CODE+=1" ) EXIT /B ::复制Bin文件 :COPY_BIN -IF NOT EXIST "%CONFIG.BIN.DST%\%~1" ( +IF NOT EXIST "%_CONFIG.BIN.DST%\%~1" ( ECHO %~1 - COPY "%~$CONFIG.BIN.SRC:1" "%CONFIG.BIN.DST%\%~1" + COPY "%~$_CONFIG.BIN.SRC:1" "%_CONFIG.BIN.DST%\%~1" EXIT /B ) EXIT /B 1 ::复制Other文件 :COPY_OTHER -IF NOT EXIST "%CONFIG.OTHER.DST%\%~1" ( +IF NOT EXIST "%_CONFIG.OTHER.DST%\%~1" ( ECHO %~1 - COPY "%~$CONFIG.OTHER.SRC:1" "%CONFIG.OTHER.DST%\%~1" + COPY "%~$_CONFIG.OTHER.SRC:1" "%_CONFIG.OTHER.DST%\%~1" EXIT /B ) EXIT /B 1