标题: [注册表类] [已解决批处理怎样查找注册表中不固定的键值并删除其键? [打印本页]
作者: huoyuan 时间: 2010-12-5 10:26 标题: [已解决批处理怎样查找注册表中不固定的键值并删除其键?
有个问题一直困扰我,还请各位高手出手相助。非常感谢
有这样的一个键值如下:
我想把其键删除,
其中的D131EDD8是不固定的,各系统的值都不同。请各位高手能否用批处理删掉这个键,谢谢
附一位网友的批处理,可一直报错:“错误:系统找不到指定的注册表项或值”- >1.reg echo Windows Registry Editor Version 5.00
- >>1.reg echo.
- for /f "tokens=2 delims={}" %%i in ('reg query "HKEY_LOCAL_MACHINE\CLSID"^|find "A677-11d7-A773-00C04F68F44E"') do echo [-HKEY_LOCAL_MACHINE\CLSID\{%%i}]>>1.reg
- regedit /s 1.reg
- del 1.reg
- pause
复制代码
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}]
- @="Vegas Pro 10.0 Kernel"
- "Merit"=dword:7ab7c1d9
-
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\InProcServer32]
- @="SONY CLSID"
- "ThreadingModel"="Both"
-
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins]
-
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Input]
-
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Input\Types]
-
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Input\Types\{10ed2d83-f16f-0348-2080-8c26b23e9a26}]
- "29"="{f5b19fe4-2a03-0126-5038-5d50f10e07d7}"
- "29C"=dword:90a6136e
- @=dword:00000001
-
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Input\Types\{97068c80-c90c-003a-e098-133100000000}]
- "0"=dword:000014d0
- "0C"=dword:23200917
- @=dword:00000002
- "44"=dword:000013d8
- "44C"=dword:e69421f8
-
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Input\Types\{c5fc7324-98a9-0138-93af-957000000040}]
- "1"=dword:ed99be20
- "1C"=dword:a5461fb0
- @=dword:00000002
- "0"=dword:000014d0
- "0C"=dword:23200917
- "44"=dword:000013d8
- "44C"=dword:e69421f8
-
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Input\Types\{e73be17c-8a0d-0125-d7a4-f683f5191a01}]
- "5"=dword:00000094
- "5C"=dword:3756c67d
- @=dword:00000002
- "10"="{3B78608F-D09A-11DF-A54E-0013D3D69929}"
- "10C"=dword:638df62a
- "8"=dword:00000001
- "8C"=dword:bdc8d7eb
-
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Input\Types\{f5b19fe4-2a03-0126-5038-5d50000000c0}]
- "0"=dword:000014d0
- "0C"=dword:23200917
- @=dword:00000001
- "44"=dword:000013d8
- "44C"=dword:e69421f8
-
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Output]
复制代码
{
[ 本帖最后由 huoyuan 于 2010-12-5 16:30 编辑 ]
作者: hanyeguxing 时间: 2010-12-5 11:15
报错是因为你把根键名打错了。
- @echo off
- for /f "skip=4 delims= " %%a in ('reg query "HKCR\CLSID"^|find /i "-A677-11d7-A773-00C04F68F44E}"') do reg delete "%%a" /f
复制代码
说明:"skip=4 delims= "中delims=后为一个tab制表符,而不是空格!~
[ 本帖最后由 hanyeguxing 于 2010-12-5 11:20 编辑 ]
作者: leap 时间: 2010-12-5 11:40
- >1.reg echo Windows Registry Editor Version 5.00
- >>1.reg echo.
- echo off
- for /f "tokens=2 delims={}" %%i in ('reg query "HKEY_CLASSES_ROOT\CLSID"') do echo %%i>>1.txt
- for /f "delims=" %%j in ('type 1.txt ^| find "A677-11d7-A773-00C04F68F44E"') do (echo [-HKEY_CLASSES_ROOT\CLSID\{%%j}]>>1.reg)
- regedit /s 1.reg
- del 1.reg
- del 1.txt
- pause
复制代码
作者: huoyuan 时间: 2010-12-5 11:54
非常感谢各位的回复可以实现,现在又出现了一个问题。就是注册表中有很多相同的键名,我只需要删除这样一个键怎么办
-
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}]
- @="Vegas Pro 10.0 Kernel"
- "Merit"=dword:7ab7c1d9
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\InProcServer32]
- @="SONY CLSID"
- "ThreadingModel"="Both"
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins]
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Input]
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Input\Types]
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Input\Types\{10ed2d83-f16f-0348-2080-8c26b23e9a26}]
- "29"="{f5b19fe4-2a03-0126-5038-5d50f10e07d7}"
- "29C"=dword:90a6136e
- @=dword:00000001
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Input\Types\{97068c80-c90c-003a-e098-133100000000}]
- "0"=dword:000014d0
- "0C"=dword:23200917
- @=dword:00000002
- "44"=dword:000013d8
- "44C"=dword:e69421f8
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Input\Types\{c5fc7324-98a9-0138-93af-957000000040}]
- "1"=dword:ed99be20
- "1C"=dword:a5461fb0
- @=dword:00000002
- "0"=dword:000014d0
- "0C"=dword:23200917
- "44"=dword:000013d8
- "44C"=dword:e69421f8
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Input\Types\{e73be17c-8a0d-0125-d7a4-f683f5191a01}]
- "5"=dword:00000094
- "5C"=dword:3756c67d
- @=dword:00000002
- "10"="{3B78608F-D09A-11DF-A54E-0013D3D69929}"
- "10C"=dword:638df62a
- "8"=dword:00000001
- "8C"=dword:bdc8d7eb
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Input\Types\{f5b19fe4-2a03-0126-5038-5d50000000c0}]
- "0"=dword:000014d0
- "0C"=dword:23200917
- @=dword:00000001
- "44"=dword:000013d8
- "44C"=dword:e69421f8
- [HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}\Pins\Output]
复制代码
作者: hanyeguxing 时间: 2010-12-5 11:58 标题: 回复 4楼 的帖子
难道2、3楼的代码还能删除HKLM、HKCU下的这些CLSID?
作者: huoyuan 时间: 2010-12-5 12:01 标题: 回复 5楼 的帖子
可以删除之前把主键名搞错了,现在就是有很多相同的键我要选择[HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}]
@="Vegas Pro 10.0 Kernel"
删除,谢谢您的回复。还请老师您多多指教
作者: hanyeguxing 时间: 2010-12-5 12:42
如果要删除[HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}]
下的@="Vegas Pro 10.0 Kernel",则只需在2楼的代码里使用/ve就可以,例如:- @echo off
- for /f %%a in ('reg query "HKCR\CLSID"^|find /i "-A677-11d7-A773-00C04F68F44E}"') do reg delete "%%a" /ve /f
复制代码
[ 本帖最后由 hanyeguxing 于 2010-12-5 13:45 编辑 ]
作者: huoyuan 时间: 2010-12-5 12:56 标题: 回复 7楼 的帖子
谢谢回复!我是想要删除带用@="Vegas Pro 10.0 Kernel这个项键的[HKEY_CLASSES_ROOT\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}]
作者: hanyeguxing 时间: 2010-12-5 13:33
楼主到底要删除什么?
1,HKCR\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}下所有的内容?- @echo off
- for /f %%a in ('reg query "HKCR\CLSID"^|find /i "-A677-11d7-A773-00C04F68F44E}"') do reg delete "%%a" /f
复制代码
1,如果要删除HKCR\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}下的@="Vegas Pro 10.0 Kernel这个项键?- @echo off
- for /f %%a in ('reg query "HKCR\CLSID"^|find /i "-A677-11d7-A773-00C04F68F44E}"') do reg delete "%%a" /ve /f
复制代码
3,查询HKCR\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}下的@="Vegas Pro 10.0 Kernel,如果有删除@="Vegas Pro 10.0 Kernel?- @echo off
- for /f %%a in ('reg query "HKCR\CLSID"^|find /i "-A677-11d7-A773-00C04F68F44E}"') do for /f "skip=4 tokens=2*" %%b in ('reg query "%%a" /ve') do if /i "%%c"=="Vegas Pro 10.0 Kernel" echo reg delete "%%a" /ve /f
复制代码
4,查询HKCR\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}下的@="Vegas Pro 10.0 Kernel,如果有删除整个项?- @echo off
- for /f %%a in ('reg query "HKCR\CLSID"^|find /i "-A677-11d7-A773-00C04F68F44E}"') do for /f "skip=4 tokens=2*" %%b in ('reg query "%%a" /ve') do if /i "%%c"=="Vegas Pro 10.0 Kernel" echo reg delete "%%a" /f
复制代码
[ 本帖最后由 hanyeguxing 于 2010-12-5 16:45 编辑 ]
作者: huoyuan 时间: 2010-12-5 15:24
原帖由 hanyeguxing 于 2010-12-5 13:33 发表
楼主到底要删除什么?
1,HKCR\CLSID\{D131EDD8-A677-11d7-A773-00C04F68F44E}下所有的内容?
@echo off
for /f %%a in ('reg query "HKCR\CLSID"^|find /i "-A677-11d7-A773-00C04F68F44E}"') do reg delete "%% ...
很谢谢这位老师耐心的解答- @echo off
- for /f %%a in ('reg query "HKCR\CLSID"^|find /i "-A677-11d7-A773-00C04F68F44E}"') do for /f "skip=4 delims=" %%b in ('reg query "%%a" /ve') do if "%%b"=="Vegas Pro 10.0 Kernel" reg delete "%%a" /ve /f 2>nul
复制代码
不知是那里有问题,注册表里这个键一直删除不了
作者: hanyeguxing 时间: 2010-12-5 16:19
- @echo off
- for /f %%a in ('reg query "HKCR\CLSID"^|find /i "-A677-11d7-A773-00C04F68F44E}"') do for /f "skip=4 tokens=2*" %%b in ('reg query "%%a" /ve') do if /i "%%c"=="Vegas Pro 10.0 Kernel" reg delete "%%a" /ve /f
复制代码
作者: huoyuan 时间: 2010-12-5 16:29
原帖由 hanyeguxing 于 2010-12-5 16:19 发表
@echo off
for /f %%a in ('reg query "HKCR\CLSID"^|find /i "-A677-11d7-A773-00C04F68F44E}"') do for /f "skip=4 tokens=2*" %%b in ('reg query "%%a" /ve') do if /i "%%c"=="Vegas Pro 10.0 Kernel" reg del ...
非常感激楼上这位老师的回复,让我一个多月来郁闷的问题得以解决。
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |