- ::解压分类
- ::BY CUTEBE @ BATHOME
- @ECHO OFF
- SET "SP=D:\C" %ZIP文件所在目录%
- SET "TP=D:\B" %解压目录%
- SET WINRAR="C:\Program Files\WinRAR\WINRAR.EXE" %解压软件%
- IF NOT EXIST "%TP%\" MD "%TP%"
- FOR /F "DELIMS=" %%Z IN ('DIR/S/B/A-D "%SP%\*.ZIP"')DO CALL :EXZIP "%%Z"
- GOTO :EOF
- ::结束
-
- :EXZIP
- SET "MZ=%~N1"
- IF "%MZ:~24%"=="" GOTO :EOF
- %WINRAR% X %1 "%TP%\" %解压代码%
- FOR /F "TOKENS=2,3 DELIMS=,-" %%A IN ("%MZ%")DO SET/aM=%%A-1,L=%%B-M
- SETLOCAL ENABLEDELAYEDEXPANSION
- FOR /F "DELIMS=" %%B IN ('DIR/B "%TP%\*.BIN"')DO (
- SET "FN=%%~NB"
- SET "FN=!FN:~%M%,%L%!"
- CALL :SMAC FN FNM
- CALL :LEN FN FNLen
- CALL :LEN FNM MLen
- CALL :MACI "!FNM!" F
- IF !FNLen!_!MLen!_!F!==!L!_12_1 (
- SET "NTP=%TP%\!FNM:~,7!"
- IF NOT EXIST "!NTP!\" MD "!NTP!"
- MOVE "%TP%\%%B" "!NTP!"
- )ELSE (
- IF NOT EXIST "%TP%\C\" MD "%TP%\C"
- MOVE "%TP%\%%B" "%TP%\C"
- )
- )
- ENDLOCAL
- ::DEL/A/F/Q %1 %请反复测试无误后再使用本条命令%
- GOTO :EOF
-
- :SMAC MACSTR VAR
- SETLOCAL ENABLEDELAYEDEXPANSION
- SET MACS=!%1!
- FOR %%M IN (- _ , .)DO SET MACS=!MACS:%%M=!
- ENDLOCAL&SET %2=%MACS%
- GOTO :EOF
-
- :MACI MACSTR FLAG
- SETLOCAL ENABLEDELAYEDEXPANSION
- SET "MACSTR=%~1"
- FOR %%S IN (0 1 2 3 4 5 6 7 8 9 A B C D E F)DO IF DEFINED MACSTR SET "MACSTR=!MACSTR:%%S=!"
- IF "!MACSTR!"=="" SET FLAG=1
- ENDLOCAL&SET %2=%FLAG%
- GOTO :EOF
-
- :LEN StrVarName LenVar %借用plp626代码%
- SETLOCAL ENABLEDELAYEDEXPANSION
- SET "$=!%1!#"
- SET N=&FOR %%A IN (4096 2048 1024 512 256 128 64 32 16)DO IF "!$:~%%A!@" NEQ "@" SET/aN+=%%A&SET "$=!$:~%%A!"
- SET "$=!$!FEDCBA9876543210"&SET/aN+=0x!$:~16,1!
- ENDLOCAL&SET/a%2=%N%
复制代码
|