本帖最后由 hfg1977 于 2011-9-9 20:02 编辑
快速定位注册表,以前写过; 其他问题本论坛多有提及,google吧.- @echo off&setlocal enabledelayedexpansion
- title 快速定位注册表
- ::检查WMI的运行状态
- for /f "tokens=4" %%a in ('sc query winmgmt^|findstr /i "STATE"') do (echo WMI的运行状态:%%~a>con&set "wmirun=%%~a")
- if /i not "%wmirun%"=="RUNNING" (
- rem 记录WMI的原始配置状态
- for /f "tokens=4" %%a in ('sc qc winmgmt^|findstr /i "START_TYPE"') do (echo WMI的原始配置状态:%%~a>con&set "wmicfg=%%~a")
- if /i "!wmicfg!"=="DISABLED" (sc config winmgmt start= AUTO)
- sc start winmgmt
- sc config winmgmt start= !wmicfg!
- )>nul 2>nul
- set "reg_des=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit"
- set "reg_Favorites=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Applets\Regedit\Favorites"
- :start
- set ee=
- set ee=
- cls
- echo ==============================================================
- echo.
- echo · 本程序用于快速定位注册表.
- echo 1. HKCU\……Run
- echo 2. HKLM\……Run
- echo 3. HKLM\……Services 服务设置
- echo · C(c) 把1~3项添加到注册表收藏夹
- echo · S(s) 新建收藏项 (meijia)
- echo · Q(q) 空回车 直接退出
- echo.
- echo · hf-g 2009-08-20 ^<彭城^>
- echo ============================================================
-
- set /p ee=输入^|粘贴要查找的注册表键值:
- if not defined ee goto :eof
- if /i "%ee%"=="q" goto :eof
- if /i "%ee%"=="c" goto :reg_sc
- set ee=%ee:HKCU=HKEY_CURRENT_USER%
- set ee=%ee:HKLM=HKEY_LOCAL_MACHINE%
- if "%ee:~-1%"=="\" set "ee=%ee:~,-1%"
- if "%ee%"=="1" goto :HKCU_Run
- if "%ee%"=="2" goto :HKLM_Run
- if "%ee%"=="3" goto :HKLM_Services
- set ee=%ee:\\=\%
- call:goto_reg %ee%
-
- :HKCU_Run
- set "ee=HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run"
- call:goto_reg %ee%
- :HKLM_Run
- set "ee=HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run"
- call:goto_reg %ee%
- :HKLM_Services
- set "ee=HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services"
- call:goto_reg %ee%
-
- :goto_reg reg_key
- reg add %reg_des% /v "LastKey" /t REG_SZ /d "%ee%" /f
- taskkill /f /im regedit.exe 2>nul
- call start regedit
- goto :start
-
- :reg_sc
- (
- reg add %reg_Favorites% /v "收藏夹" /t REG_SZ /d %reg_Favorites% /f
- reg add %reg_Favorites% /v "HKCU_Run" /t REG_SZ /d "HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run" /f
- reg add %reg_Favorites% /v "HKLM_Run" /t REG_SZ /d "HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Windows\CurrentVersion\Run" /f
- reg add %reg_Favorites% /v "服务设置" /t REG_SZ /d "HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services" /f
- reg add %reg_Favorites% /v "运行历史记录" /t REG_SZ /d HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\RunMRU /f
- reg add %reg_Favorites% /v "hf'file" /d "HKEY_LOCAL_MACHINE\Software\hf'file" /f
- )>nul&goto :start
- pause
复制代码
|