注册表的编写与使用
1、编写 reg 文件的头文件
Windows Registry Editor Version 5.00
2、项的增加与删除
// 增加:直接写清楚地址就行
[HKEY_CLASSES_ROOT\Directory\Background\shell\Power off\command]
// 删除:在HKEY前头加个减号"-"
[-HKEY_CLASSES_ROOT\Directory\Background\shell\Power off\command]
3、值的增加删除修改
// 增加:格式 "值的名称"="值的内容" 或者"值的名称"=值的类型:值的内容 (默认是字符串值)
// 如果值原本不存在,那就是创建,如果原本存在,那就是修改
[HKEY_CLASSES_ROOT\Directory\Background\shell\Power off\command]
"关机"="poweroff"
"关机"=dword:111
// 删除:格式 "值的名称"=-
[HKEY_CLASSES_ROOT\Directory\Background\shell\Power off\command]
"关机"=-
4、默认值的修改
[HKEY_CLASSES_ROOT\Directory\Background\shell\Power off\command]
@="poweroff"
// 这样就可以把command下面的默认值的值修改为poweroff
5、保存
注意:编写好之后另存为ANSI格式(可能会涉及到中文),后缀名为.reg的文件就可以了,然后双击打开即可
在注册表里也可因导出写好的reg文件出来,同样发给别人直接运行即可。
6、例子
右击滑动关机
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Directory\Background\shell\滑动关机\command]
@="slidetoshutdown"
取消-右击滑动关机
Windows Registry Editor Version 5.00
[-HKEY_CLASSES_ROOT\Directory\Background\shell\滑动关机]
@=-
右键添加百度一下
// 右键添加百度一下
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\DesktopBackground\Shell\WebSearch]
"MUIVerb"="百度一下,你就知道"
"Icon"="Windows.Storage.Search.dll,0"
[HKEY_CLASSES_ROOT\DesktopBackground\Shell\WebSearch\Command]
@="explorer \"https://www.baidu.com\""