## 注册表简介
注册表是windows系统中具有层次结构的核心数据库,储存的数据对windows 和Windows上运行的应用程序和服务至关重要。注册表时帮助windows控制硬件、软件、用户环境和windows界面的一套数据文件。
## 开启/禁用注册表编辑器
1、开启注册表(注意开头之后第二行一定要是空行并且不可少)
```cmd
REGEDIT4
[HKEY_USERS\.DEFAULT\Software\Microsoft\Windows\CurrentVersion\Policies\system]
"DisableRegistryTools"=dword:00000000
```
2、锁定注册表编辑器的方法(注意开头之后第二行一定要是空行并且不可少)
```cmd
Windows Registry Editor Version 5.00
[HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Policies\System]
"DisableRegistryTools"=dword:00000001
```
## 注册表结构
键值: 名称、类型、数据。
键值的类型:
- 字符串值(REG_SZ)
- 二进制值(REG_BINARY)
- 32位值(4个字节)(REG_DWORD)
- 64位值(5个字节)(REG_QWORD)
- 多字符串值(REG_MULTI_SZ)
- 可扩充字符串值(REG_EXPAND_SZ)
## 常用位置
```bash
#常见的开机自启动注册表路径:
HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Run
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Run
#卸载程序
HKEY_CURRENT_USER\SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall
#右键自定义
右键空白区域-桌面空白区域:HKEY_CLASSES_ROOT\DesktopBackground\Shell
右键空白区域-一般空白区域-管理员:HKEY_CLASSES_ROOT\Directory\Background\shell
右键空白区域-一般空白区域-普通用户:HKEY_CURRENT_USER\Software\Classes\directory\Background\shell
右键文件夹-管理员:HKEY_CLASSES_ROOT\Directory\shell
右键文件夹-普通用户:HKEY_CLASSES_ROOT\Directory\shell
右键文件-管理员:HKEY_CLASSES_ROOT\*\shell
右键文件-普通用户:HKEY_CURRENT_USER\Software\Classes\*\shell
```
## 右键控制台
```
HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\Background\shell\控制台
icon REG_ExPAND_SZ cmd.exe
HKEY_CURRENT_USER\SOFTWARE\Classes\Directory\Background\shell\控制台\command
(默认) REG_SZ cmd.exe
```
## 右键去掉多余项
```
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\AnyCode]
[-HKEY_CLASSES_ROOT\Directory\shell\AnyCode]
```
## 注册表卸载软件
```bash
HKEY_LOCAL_MACHINE\Software\Microsoft\Windows\CurrentVersion\Uninstall
UninstallString对应值
```