我想用批处理命令直接在 HKEY_CLASSES_ROOT 下添加一个关键目录(就像子文件夹一样)

I want to add a key directory directly under HKEY_CLASSES_ROOT with batch command (as like a subfolder)

我想用批处理命令直接在HKEY_CLASSES_ROOT下添加一个密钥文件夹(..NewKey)(像子文件夹一样,在左侧),然后将几个密钥添加到这个密钥文件夹中。如果我尝试手动执行此操作,然后右键单击 HKEY_CLASSES_ROOT,我可以使用添加密钥来执行此操作(参见图片 1)如果我尝试使用如下所示的 reg 添加命令,则直接在 HKEY_CLASSES_ROOT 中生成密钥(见图2)我做错了什么?

reg 添加“HKEY_CLASSES_ROOT”/v ..NewKey /t REG_SZ /d 服务器

您需要将新键名称指定为 KeyName 参数的一部分,然后指定 /ve。这将创建具有空 (Default) 值的密钥。或者,添加具有适当值的 /t/d 参数,以创建具有非空 (Default) 值的密钥。

reg add "hkcr\...NewKey" /ve

reg add "hkcr\...NewKey" /ve /t REG_SZ /d "Server"

REG ADD KeyName [/v ValueName | /ve] [/t Type] [/s Separator] [/d Data] [/f] [/reg:32 | /reg:64]

KeyName [\Machine]FullKey Machine Name of remote machine - omitting defaults to the current machine. Only HKLM and HKU are available on remote machines. FullKey ROOTKEY\SubKey ROOTKEY [ HKLM | HKCU | HKCR | HKU | HKCC ] SubKey The full name of a registry key under the selected ROOTKEY.

/v The value name, under the selected Key, to add.

/ve adds an empty value name (Default) for the key.

/t RegKey data types [ REG_SZ | REG_MULTI_SZ | REG_EXPAND_SZ | REG_DWORD | REG_QWORD | REG_BINARY | REG_NONE ] If omitted, REG_SZ is assumed.

/s Specify one character that you use as the separator in your data string for REG_MULTI_SZ. If omitted, use "[=18=]" as the separator.

/d The data to assign to the registry ValueName being added.

/f Force overwriting the existing registry entry without prompt.