What can the REG.EXE command do in Windows XP?
REG.EXE does almost everything Regedt32 can do, but it allows you to do it from a command line. This can be useful when you want to quickly make a change without opening Regedt32, and it also allows you to embed registry operations in logon scripts and batch files.
Resource Kit to add this tool. You can download REG.EXE from here: Download Free Windows 2000 Resource Kit Tools
You can use REG.EXE by giving it a command from a short list of options (query, add, update, delete, copy, save, backup, restore, load, and unload), followed by one or more optional parameters that the command you specify will interpret.
Querying keys
REG query allows you to query a single key for a single value, or a range of keys for all their values. This provides you with a quick way to check whether a key has the value you think it does, or in fact whether it has any values associated with it at all:
REG QUERY KeyName [/v ValueName | /ve] [/s]
-
KeyName [\\Machine\]FullKey
Machine - Name of remote machine, omitting defaults to the current machine (Note: the REG.EXE help syntax is wrong. You should use \\ and NOT \ as written!)
Only HKLM and HKU are available on remote machines
FullKey - in the form of ROOTKEY\SubKey name
ROOTKEY [ HKLM | HKCU | HKCR | HKU | HKCC ]
SubKey - The full name of a registry key under the selected ROOTKEY
-
/v query for a specific registry key
ValueName - The name, under the selected Key, to query
if omitted, all values under the Key are queried
-
/ve query for the default value or empty value name <no name>
-
/s queries all subkeys and values
Example:
C:\WINDOWS>reg query \\srv1\hklm\software\symantec ! REG.EXE VERSION 3.0
HKEY_LOCAL_MACHINE\software\symantec
HKEY_LOCAL_MACHINE\software\symantec\InstalledApps
HKEY_LOCAL_MACHINE\softwaresymantec\LiveUpdate
HKEY_LOCAL_MACHINE\software\symantec\NAVMSE
HKEY_LOCAL_MACHINE\software\symantec\Norton AntiVirus
HKEY_LOCAL_MACHINE\software\symantec\Norton AntiVirus NT
HKEY_LOCAL_MACHINE\software\symantec\Shared Technology
HKEY_LOCAL_MACHINE\software\symantec\SharedDefs
HKEY_LOCAL_MACHINE\software\symantec\SharedUsage
HKEY_LOCAL_MACHINE\software\symantec\Symevent
Adding new keys
REG.EXE add adds new keys and values to the Registry. You can add a value to an existing key, add a new key with no values, or create a new key and a value beneath it. If you try to add a key or value that already exists, REG.EXE will warn you.
REG ADD KeyName [/v ValueName | /ve] [/t Type] [/s Separator] [/d Data] [/f]
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 <no name> for the key
-
/t RegKey data types:
[ REG_SZ, REG_MULTI_SZ, REG_DWORD_BIG_ENDIAN, REG_DWORD, REG_BINARY, REG_DWORD_LITTLE_ENDIAN, REG_NONE, REG_EXPAND_SZ ] If omitted, REG_SZ is assumed
-
/s Specify one charactor 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
Examples:
REG ADD \\ABC\HKLM\Software\MyCo Adds a key HKLM\Software\MyCo on remote machine ABC
REG ADD HKLM\Software\MyCo /v Data /t REG_BINARY /d fe340ead Adds a value (name: Data, type: REG_BINARY, data: fe340ead)
REG ADD HKLM\Software\MyCo /v MRU /t REG_MULTI_SZ /d fax\0mail Adds a value (name: MRU, type: REG_MUTLI_SZ, data: fax\0mail\0\0)
REG ADD HKLM\Software\MyCo /v Path /t REG_EXPAND_SZ /d %%systemroot%% Adds a value (name: Path, type: REG_EXPAND_SZ, data: %systemroot%) Notice: Use the double percentage ( %% ) inside the expand string
Removing a key
REG delete removes a key or value. When removing a key, it will remove all subkeys and values beneath that key; however, it will ask you to confirm your intentions before it actually deletes anything. As with REG update, you can only delete keys where the ACLs (and/or the remote Registry settings) allow you access.
REG DELETE KeyName [/v ValueName | /ve | /va] [/f]
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
-
ValueName The value name, under the selected Key, to delete. When omitted, all subkeys and values under the Key are deleted
-
/ve delete the value of empty value name <no name>
-
/va delete all values under this key
-
/f Forces the deletion without propmt
Examples:
REG DELETE HKLM\Software\MyCo\MyApp\Timeout Deletes the registry key Timeout and its all subkeys and values
REG DELETE \\ZODIAC\HKLM\Software\MyCo /v MTU Deletes the registry value MTU under MyCo on ZODIAC
Copying keys and values
You can use the command to copy a single value or an entire hive from its original location to another; the target location can be on the same machine as the source or on any other machine on the network. This command makes short work out of tasks like copying a standard set of file associations to new machines or tweaking one machine so its configuration matches another.
REG COPY KeyName1 KeyName2 [/s] [/f]
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
Examples:
REG COPY HKLM\Software\MyCo\MyApp HKLM\Software\MyCo\SaveMyApp /s Copies all subkeys and values under the key MyApp to the key SaveMyApp
REG COPY \\ZODIAC\HKLM\Software\MyCo HKLM\Software\MyCo1 Copies all values under the key MyCo on ZODIAC to the key MyCo1 on the current machine
Saving and restoring keys
The REGBACK and REGREST utilities allow you to back up and restore entire hives. To save a key and its values, you can use either reg save or reg backup:
REG SAVE KeyName FileName
ROOTKEY [ HKLM | HKCU | HKCR | HKU | HKCC ]
SubKey The full name of a registry key under the selected ROOTKEY
Examples:
REG SAVE HKLM\Software\MyCo\MyApp AppBkUp.hiv Saves the hive MyApp to the file AppBkUp.hiv in the current folder
REG RESTORE KeyName FileName
ROOTKEY [ HKLM | HKCU | HKCR | HKU | HKCC ]
SubKey The full name of a registry key to restore the hive file into. Overwriting the existing key's values and subkeys
You must use REG SAVE to create this file
Examples:
REG RESTORE HKLM\Software\Microsoft\ResKit NTRKBkUp.hiv Restores the file NTRKBkUp.hiv overwriting the key ResKit
Loading and unloading hives
Regedt32 lets you load and unload saved keys as hives immediately beneath HKLM or HKU. The REG.EXE utility gives you the same ability and with the same limitations.
To load a hive, you use the REG load command. Unlike REG restore, REG load loads the hive by adding it with the key name you specify instead of overwriting the key you specify. This makes it possible for you to use REG load to load a saved hive, edit it, and unload it again without making any changes to the rest of your registry. Here's what the command looks like:
REG LOAD KeyName FileName
ROOTKEY [ HKLM | HKU ]
SubKey The key name to load the hive file into. Creating a new key
You must use REG SAVE to create this file
Examples:
REG LOAD HKLM\TempHive TempHive.hiv Loads the file TempHive.hiv to the Key HKLM\TempHive
REG UNLOAD KeyName
ROOTKEY [ HKLM | HKU ]
SubKey The key name of the hive to unload
Examples:
REG UNLOAD HKLM\TempHive Unloads the hive TempHive in HKLM
<!-- google_ad_section_end --><!-- begin ad tag (tile=2) --><!-- begin ad tag (ns.petri;300x250,336x280) -->
分享到:
相关推荐
《Windows Administration at the Command Line for Windows - 651页》这本书由John Paul Mueller撰写,主要涵盖了Windows Vista、Windows 2003、Windows XP以及Windows 2000等操作系统在命令行环境下的管理技术。...
标题 "open command window here, window xp下的一个好工具" 提及的是在Windows XP操作系统中,如何快速打开命令提示符窗口的技巧。这个功能允许用户在任何文件夹位置直接启动命令行界面,无需通过“开始”菜单或...
在实际应用中我们会把这条命令和重定向符号(也称为管道符号,一般用> >> ^)结合来实现输入一些命令到特定格式的文件中.这将在以后的例子中体现出来。 2.@ 命令 表示不显示@后面的命令,在入侵过程中(例如使用...
2. **功能增强**:现在可以通过右键点击文件夹并选择`Command Prompt Here`来直接在该文件夹下打开命令提示符,极大地方便了开发人员和高级用户的使用。 3. **扩展性考虑**:这种自定义功能可以根据个人需求进行...
Value is expressed in hexadecimal, and consists in a classic Red/Green/Blue color code : RRGGBB 信息框使用字体颜色。RBG颜色:RRGGBB/000060 - LabelFontName : Font used for the label boxes. 标签框字体...
XP系统与AHCI的兼容性问题主要是由于XP原生不支持AHCI,但通过正确的方法和合适的驱动,用户仍然可以在XP系统上享受AHCI带来的高速度和灵活性。随着技术的发展,现在的操作系统如Windows 7及更高版本已经内置了对...
现象:我装了Windows Me和Windows XP双系统,都是FAT32格式。C盘装 Windows Me,E盘装Windows XP。昨天,Windows XP系统丢失了SYSTEM32.DLL ,启动不了。于是我在进入Windows Me系统内,在E盘直接删除Windows XP...
在Windows XP系统中,动态链接库(DLL)和对象链接与嵌入控件(OCX)是非常重要的组件,它们通常用于提供各种功能和服务给应用程序。为了方便地注册或卸载这些组件,可以通过修改注册表来为DLL和OCX文件添加“注册”...
本文将详细介绍如何通过命令行工具或远程管理方式来更改Windows系统(特别是Windows XP)中本地账户的共享和安全模式。 #### 一、通过注册表编辑器修改 在Windows XP中,可以通过编辑注册表来更改本地账户的共享和...
当Windows 2000/XP系统出现严重问题时,可以从`C:\Windows\Repair`目录下复制初始注册表文件(如`System`, `Software`, `Sam`, `Security`, `Default`等)到`System32\Config`目录下,以恢复系统基本配置。...
PowerShell是一种在Windows操作系统下使用的命令行外壳程序和脚本语言,它被集成在Windows XP、Server 2003、Vista、Server 2008以及更新的Windows系统中。PowerShell的出现改变了传统的命令行处理方式,从处理文本...
通过这种方法,即使在Windows 8的新界面下,你也可以方便地在桌面环境中使用熟悉的关机、重启和注销功能。这个过程虽然涉及到注册表编辑,但只要按照步骤进行,就不会对系统造成影响。当然,如果你不熟悉这些操作,...
在Windows XP操作系统中,"我的电脑"(也称为"计算机")右键菜单中的"管理"选项是一个非常重要的功能,它允许用户访问系统的各种管理工具,如设备管理器、服务和应用程序、磁盘管理等。当这个选项出现错误或者无反应...
PowerShell是一种强大的脚本语言和命令行shell,主要应用于Windows操作系统,如XP、Server 2003、Vista和Server 2008。不同于传统的外壳程序(如Cmd.exe、SH、KSH、CSH和BASH),PowerShell的设计理念和功能特性有...
《Win7下使用超级终端:自动化安装与使用指南》 Windows 7系统虽然与它的前任XP有所不同,但依然可以通过特定的方式使用经典的“超级终端”...熟悉超级终端的使用方法,将极大地提升你在系统管理和故障排查中的效率。
`xp_cmdshell`是SQL Server中一个强大的系统级存储过程,它可以用来执行任意Windows命令。默认情况下,只有SYSADMIN服务器角色的用户才有权限执行此过程。例如,可以通过以下方式创建一个新的用户: ```sql exec ...
在Windows XP操作系统中,错误报告是一项默认开启的功能。当应用程序或系统遇到问题时(例如程序崩溃),该功能会自动启动,收集有关错误的信息,并向Microsoft发送这些信息以寻求解决方案。此机制旨在帮助改进系统...
根据给定文件的信息,我们可以总结出一系列实用的电脑小技巧,涵盖了从系统优化到日常使用的各个方面。以下是这些技巧的详细解析: ### 1. 解决影音文件无法删除的问题 **问题描述**:在Windows XP系统中,用户...