说明,以下所有代码中:"skip=4 delims= "的delims=后为一个tab制表符,不是空格!~
只删除非@开头的- @echo off&setlocal enabledelayedexpansion
- set r=HKCU\Software\Microsoft\Windows\ShellNoRoam\MUICache
- for /f "skip=4 delims= " %%a in ('reg query %r%') do (
- set a=%%a
- if not "!a:~0,5!"==" @" reg delete %r% /v "!a:~4!" /f
- )
复制代码 只删除c、d、e、f、g开头的- @echo off&setlocal enabledelayedexpansion
- for %%a in (c d e f g) do set ""# %%a"=="
- set r=HKCU\Software\Microsoft\Windows\ShellNoRoam\MUICache
- for /f "skip=4 delims= " %%a in ('reg query %r%') do (
- set a=%%a
- if defined "#!a:~0,5!" reg delete %r% /v "!a:~4!" /f
- )
复制代码
对于以上两个代码,可以附加删除条件:键名所指向的文件不存在才删除。将代码
复制代码 插入到 reg delete 之前即可。
[ 本帖最后由 hanyeguxing 于 2010-12-5 07:32 编辑 ] |