将.reg文件导入到远程计算机的注册表中 [英] Import a .reg file to a remote machine's registry

查看:318
本文介绍了将.reg文件导入到远程计算机的注册表中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,

我正在互联网上搜索该主题,但是运气不高,所以我现在在这里尝试运气,大声笑

我的情况是:我正在拥有一个托管发布应用程序和备份的集中发布服务器,现在我想扩展此应用程序,以允许用户将位于发布服务器上的.reg文件导入到远程计算机上.

举例来说,在Windows中,如果我们打开注册表编辑器,并且有一个"Connect Network Registry"选项,那么我们可以连接到远程计算机,一旦连接,我们就可以从本地mahcine中选择.reg文件并导入进入远程机器.我们的发布应用程序希望实现相同的目标.

希望我能清楚地描述这种情况,并且由于Windows能够做到这一点,所以我确信在.Net中有一种方法可以实现,因此有人可以向我指出正确的方向.

谢谢堆.

回复·电子邮件·查看线程

Hi All,

I was searching on Internet with this topic but dont have much luck, so i am trying my luck in here now, lol

My scenario is: i am havning a centralise release server that hosts the release applicaiton and backups, and now i would like to extend this application to allow the user to import the .reg file, sits on the release server, to a remote machine.

just as an example, in windows, if we open registry edit, and we have an option "Connect Network Registry", so we can connec to remote machine, and once we connected, we can select the .reg file from local mahcine and import into the remote machine. Our release application would like to achieve the same goal.

Hopefully i describe the scenario cleary, and since Windows is able to do it, then i am sure there is a way to do it in .Net, can someone in here point me to the right direction.

Thanks heaps.

Reply·Email·View Thread

推荐答案

资源工具包以添加此工具.您可以从此处下载REG.EXE:下载免费的Windows 2000资源工具包工具

您可以使用REG.EXE,方法是从一小段选项中为其提供命令(查询,添加,更新,删除,复制,保存,备份,还原,加载和卸载),然后通过该命令提供一个或多个可选参数.您指定的将进行解释.
查询键

REG查询使您可以为单个值查询单个键,或者为所有值查询一个键范围.这为您提供了一种快速的方法来检查键是否具有您认为的值,或者实际上是否具有与之关联的任何值:

REG QUERY键名[/v ValueName | /ve] [/s]

键名[\\ Machine \] FullKey

机器-远程机器的名称,默认为当前机器(注意:REG.EXE帮助语法错误.您应使用\\而不是书面的\!)

远程计算机上只能使用HKLM和HKU

FullKey-以ROOTKEY \ SubKey名称的形式

ROOTKEY [HKLM |香港中文大学| HKCR |香港大学| HKCC]

SubKey-所选ROOTKEY下的注册表项的全名

/v查询特定的注册表项

ValueName-在所选键下要查询的名称

如果省略,则查询键下的所有值

/ve查询默认值或空值名称< no name>

/s查询所有子项和值

示例:

C:\ WINDOWS> reg查询\\ srv1 \ hklm \ software \ symantec! REG.EXE版本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

添加新键

REG.EXE添加将新的键和值添加到注册表.您可以将值添加到现有键,添加没有值的新键或在其下创建一个新键和一个值.如果您尝试添加已经存在的键或值,则REG.EXE会警告您.

REG添加键名[/v值名| /ve] [/t类型] [/s分隔符] [/d数据] [/f]

键名[\\ Machine \] FullKey

远程计算机的计算机名称-省略默认为当前计算机.远程计算机上只能使用HKLM和HKU

FullKey ROOTKEY \ SubKey

ROOTKEY [HKLM |香港中文大学| HKCR |香港大学| HKCC]

SubKey所选ROOTKEY下的注册表项的全名

/v在选定键下要添加的值名称

/ve添加一个空值名称< no name>钥匙

/t RegKey数据类型:

[REG_SZ,REG_MULTI_SZ,REG_DWORD_BIG_ENDIAN,REG_DWORD,REG_BINARY,REG_DWORD_LITTLE_ENDIAN,REG_NONE,REG_EXPAND_SZ]如果省略,则假定为REG_SZ

/s在REG_MULTI_SZ的数据字符串中指定一个用作分隔符的字符.如果省略,请使用"\ 0"作为分隔符

/d分配给要添加的注册表ValueName的数据

/f在没有提示的情况下强制覆盖现有的注册表项

例子:

REG ADD \\ ABC \ HKLM \ Software \ MyCo在远程计算机ABC上添加密钥HKLM \ Software \ MyCo

REG ADD HKLM \ Software \ MyCo/v数据/t REG_BINARY/d fe340ead添加一个值(名称:数据,类型:REG_BINARY,数据:fe340ead)

REG ADD HKLM \ Software \ MyCo/v MRU/t REG_MULTI_SZ/d Fax \ 0mail添加一个值(名称:MRU,类型:REG_MUTLI_SZ,数据:Fax \ 0mail \ 0 \ 0)

REG ADD HKLM \ Software \ MyCo/v路径/t REG_EXPAND_SZ/d %% systemroot %%添加一个值(名称:Path,类型:REG_EXPAND_SZ,数据:%systemroot%)注意:请在扩展字符串

取出钥匙

REG delete删除键或值.删除键时,它将删除该键下的所有子键和值.但是,它会要求您在实际删除任何内容之前确认您的意图.与REG更新一样,您只能删除ACL(和/或远程注册表设置)允许您访问的项.
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]

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 <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文件导入到远程计算机的注册表中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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