lovekix 当前离线
二级士官
for /f "delims=" %%i in ('dir /b /a-d Microsoft-Windows-*') do del /a /f /q %%i复制代码
路过 当前离线
三级士官
TOP
@echo off cd /d "C:\Windows\servicing\Packages" set "skip=0" for /f "delims=:" %%i in ('findstr /b /n ":list" "%~0"') do set "skip=%%i" for /f "usebackq skip=%skip% delims=" %%i in ("%~0") do call set "save=%%save%%:%%i" for /f "delims=" %%i in ('dir /b /a-d ^| findstr /b /v "%save::= %"') do del %%i pause&exit REM 开头保存字符串,一行一个 :list Microsoft-Windows-2 Package Microsoft-Windows-Branding复制代码
went 当前离线
少校
qixiaobin0715 当前离线
大校
@echo off set var="Package Microsoft-Windows-" cd /d "C:\Windows\servicing\Packages" for /f "delims=" %%i in ('dir /b /a-d ^| findstr /bv %var%') do del /a /f /q "%%i" pause复制代码
if "!st!" neq "Package" ( del /a /f /q %%i复制代码
@echo off cd /d "C:\Windows\servicing\Packages" for /f "delims=:" %%i in ('findstr /b /n ":list" "%~0"') do for /f "delims=" %%a in ('more +%%i "%~0"') do call set "save=%%save%%:%%a" for /f "delims=" %%i in ('dir /b /a-d ^| findstr /b /v "%save::= %"') do del %%i pause&exit REM 开头保存字符串,一行一个 :list Microsoft-Windows- Package复制代码
@echo off cd /d "C:\Windows\servicing\Packages" for /f "delims=:" %%i in ('findstr /b /n ":list" "%~0"') do for /f "delims=" %%a in ('more +%%i "%~0"') do call set "save=%%save%%:%%a" for /f "delims=" %%i in ('dir /b /a-d ^| findstr /b /v "%save::= %"') do echo %%i pause&exit REM 开头保存字符串,一行一个 :list Microsoft-Windows- Package复制代码
@echo off setlocal enabledelayedexpansion for /f "delims=" %%i in ('dir /b /a-d') do ( set file=%%~i set st=!file:~0,18! if "!st!" neq "Microsoft-Windows-" ( set st=!file:~0,7! if "!st!" neq "Package" ( del /a /f /q %%i ) ) ) pause exit复制代码