Skip to content

Commit

Permalink
变量前加_前缀
Browse files Browse the repository at this point in the history
  • Loading branch information
PowerWordTree committed Dec 30, 2023
1 parent 0d9ac76 commit ddec4c6
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions ScriptDependents.cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
::获取脚本依赖
::@author FB
::@version 1.1.0
::@version 1.1.1

::Bin:Dumpbin.exe::
::Bin:Link.exe::
Expand All @@ -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
Expand All @@ -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%

::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

Expand All @@ -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
Expand All @@ -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

0 comments on commit ddec4c6

Please sign in to comment.