
【已解決】批處理怎么查A文本中的文本是否在B文本中最后由 hentai87 于 -6-4 20:11Remove.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=%%afor /f skip=%n% delims= %%b in (..set.txt) do (set MT=%%bMountInstallset dism=%%bBinx64DISM10dism.exe)::-------------加載卸載注冊表:SETRecho.echo 載入注冊表reg load HKLMSOFT %MT%WindowsSystem32configsoftwarefor /f %%i in ('findstr /i . Remove.txt 2^>nul') do ( call :SETVALUE %%i )echo.echo 卸載注冊表完成reg unload HKLMSOFT::-------------卸載系統包( 有疑問的部分)dir /b %MT%WindowsservicingPackages*.mum >Packages.txtfor /f %%i in ('findstr /i . Remove.txt 2^>nul') do %dism% /NoRestart /image:%MT% /Remove-package /Packagename:%%ipauseexit::-------------修改注冊表:SETVALUEecho.echo 修改Visibilityreg add HKLMSOFTMicrosoftWindowsCurrentVersionComponent based ServicingPackages%~1 /v Visibility /t REG_DWORD /d 1 /fecho.echo 刪除Ownersreg delete HKLMSOFTMicrosoftWindowsCurrentVersionComponent based ServicingPackages%~1Owners /fgoto:eof[/code]

