是否可以通过 .bat/.cmd 脚本修改注册表项? [英] Is it possible to modify a registry entry via a .bat/.cmd script?

查看:19
本文介绍了是否可以通过 .bat/.cmd 脚本修改注册表项?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以通过 .bat/.cmd 脚本修改注册表值(无论是字符串还是 DWORD)?

Is it possible to modify a registry value (whether string or DWORD) via a .bat/.cmd script?

推荐答案

您可以使用 REG 命令.来自 http://www.ss64.com/nt/reg.html:>

You can use the REG command. From http://www.ss64.com/nt/reg.html:

Syntax:

   REG QUERY [ROOT]RegKey /v ValueName [/s]
   REG QUERY [ROOT]RegKey /ve  --This returns the (default) value

   REG ADD [ROOT]RegKey /v ValueName [/t DataType] [/S Separator] [/d Data] [/f]
   REG ADD [ROOT]RegKey /ve [/d Data] [/f]  -- Set the (default) value

   REG DELETE [ROOT]RegKey /v ValueName [/f]
   REG DELETE [ROOT]RegKey /ve [/f]  -- Remove the (default) value
   REG DELETE [ROOT]RegKey /va [/f]  -- Delete all values under this key

   REG COPY  [\SourceMachine][ROOT]RegKey [\DestMachine][ROOT]RegKey

   REG EXPORT [ROOT]RegKey FileName.reg
   REG IMPORT FileName.reg
   REG SAVE [ROOT]RegKey FileName.hiv
   REG RESTORE \MachineName[ROOT]KeyName FileName.hiv

   REG LOAD FileName KeyName
   REG UNLOAD KeyName

   REG COMPARE [ROOT]RegKey [ROOT]RegKey [/v ValueName] [Output] [/s]
   REG COMPARE [ROOT]RegKey [ROOT]RegKey [/ve] [Output] [/s]

Key:
   ROOT :
         HKLM = HKey_Local_machine (default)
         HKCU = HKey_current_user
         HKU  = HKey_users
         HKCR = HKey_classes_root

   ValueName : The value, under the selected RegKey, to edit.
               (default is all keys and values)

   /d Data   : The actual data to store as a "String", integer etc

   /f        : Force an update without prompting "Value exists, overwrite Y/N"

   \Machine : Name of remote machine - omitting defaults to current machine.
                Only HKLM and HKU are available on remote machines.

   FileName  : The filename to save or restore a registry hive.

   KeyName   : A key name to load a hive file into. (Creating a new key)

   /S        : Query all subkeys and values.

   /S Separator : Character to use as the separator in REG_MULTI_SZ values
                  the default is "" 

   /t DataType  : REG_SZ (default) | REG_DWORD | REG_EXPAND_SZ | REG_MULTI_SZ

   Output    : /od (only differences) /os (only matches) /oa (all) /on (no output)

这篇关于是否可以通过 .bat/.cmd 脚本修改注册表项?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆