如何使用 CMD 脚本更改 regedit 上的值?

问题描述

有人可以帮我制作一个 cmd 脚本来更改 3400 个子文件夹中 3000 个的值,该值应该更改为最新值而不影响 400 个子文件夹吗?

旧的dbpassword值为Pass123,最新的值为Pass234。

HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Myfolder\Mainfolder\BRN3130\Database

https://i.stack.imgur.com/saCZI.jpg

解决方法

使用 reg.exe 而不是 regedit。

注册添加 /?

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 "\0" as the separator.

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

  /f       Force overwriting the existing registry entry without prompt.

  /reg:32  Specifies the key should be accessed using the 32-bit registry view.

  /reg:64  Specifies the key should be accessed using the 64-bit registry view.

使用 /f 添加 Reg 将帮助您覆盖现有值。