|
- @ECHO OFF
- SETLOCAL ENABLEDELAYEDEXPANSION
- REM 选择适合本任务的DISM.EXE
- IF /I %PROCESSOR_IDENTIFIER:~0,3%==X86 (SET BIT=X86) ELSE (SET BIT=AMD64)
- FOR /F "DELIMS=" %%A IN ('REG QUERY HKLM\SOFTWARE\MICROSOFT\WINDOWS\CURRENTVERSION\INSTAllER\FOlDERS^|FIND /I "\ASSESSMENT AND DEPlOYMENT KIT\DEPlOYMENT TOOlS\%BIT%\DISM"') DO (
- FOR /F "TOKENS=*" %%I IN ("%%A") DO (
- SET "STR=%%I"
- SET "STR=!STR: REG_SZ 1=!"
- SET "STR=!STR: REG_SZ =!"
- CALL :INTERCEPT
- IF EXIST "!STR!wimmountadksetup%BIT%.exe" (
- FOR /F "DELIMS=" %%G IN ('ECHO !STR!DISM.EXE') DO SET DSM=%%~SG
- FOR /F "TOKENS=2-4 DELIMS=^:." %%a IN ('!DSM!^|Find /i "版本:"') DO SET dv=%%a%%b%%c&GOTO :AAAA
- )
- )
- )
- SET DSM=dism.exe&goto :Begin
- :AAAA
- %windir%\system32\DISM.EXE
- FOR /F "TOKENS=2-4 DELIMS=^:." %%a IN ('%windir%\system32\DISM.EXE^|Find /i "版本:"') DO (SET dvw=%%a%%b%%c
- IF !DVw! GTR %dv% SET "DSM=%windir%\system32\DISM.EXE"
- )
- :Begin
- cls
- echo 所选的dism为“%DSM%”。
- rem ................................................................................程序主体..........................................
- :End
- pause
- pause
- exit /b
- :INTERCEPT
- IF "%STR:~-1%"==" " SET "STR=%STR:~0,-1%"&GOTO INTERCEPT
- GOTO :EOF
复制代码
|
|