Remove.txt 中的文本不在Packages.txt,
则不执行for /f %%i in ('findstr /i . Remove.txt 2^>nul') do %dism% /NoRestart /image:%MT% /Remove-package /Packagename:"%%i"
代码已标出有问题部分
pushd "%~dp0"
::-------------设置win路径和dism路径
for /f "delims=:" %%a in ('findstr /n msmg设置 ..\set.txt') do set n=%%a
for /f "skip=%n% delims=" %%b in (..\set.txt) do (
set MT=%%b\Mount\Install
set dism=%%b\Bin\x64\DISM10\dism.exe
)
::-------------加载卸载注册表
:SETR
echo.
echo 载入注册表
reg load HKLM\SOFT "%MT%\Windows\System32\config\software"
for /f %%i in ('findstr /i . Remove.txt 2^>nul') do ( call :SETVALUE %%i )
echo.
echo 卸载注册表完成
reg unload HKLM\SOFT
::-------------卸载系统包( 有疑问的部分 )
dir /b %MT%\Windows\servicing\Packages\*.mum >Packages.txt
for /f %%i in ('findstr /i . Remove.txt 2^>nul') do %dism% /NoRestart /image:%MT% /Remove-package /Packagename:"%%i"
pause
exit
dir /b %MT%\Windows\servicing\Packages\*.mum >ackages.txt
for /f "delims=" %%i in ('findstr /gackages.txt /x Remove.txt 2^>nul') do (
for /f %%i in ('findstr /i . Remove.txt 2^>nul') do %dism% /NoRestart /image:%MT% /Remove-package /Packagename:"%%i"
)