『楼 主』:
在DOS环境下玩转Windows注册表
使用 LLM 解释/回答一下
在DOS环境下玩转Windows注册表
文/红枫林
注册表编辑器不仅可以在Windows下运行使用,还可以在MS-DOS实模式下运行。有时注册表受到损坏而无法启动Windows时,我们就只有在DOS模式下修复或修改注册表了。注册表的实际物理文件为System.dat和User.dat,也就说注册表中的数据保存在这两个文件中。
导出注册表
此命令可以实现对注册表文件进行备份。
命令格式:Regedit /L:system /R:user /E filename.reg Regpath
参数含义:
/L:system指定System.dat文件所在的路径。
/R:user指定User.dat文件所在的路径。
/E:此参数指定注册表编辑器要进行导出注册表操作,在此参数后面空一格,输入导出注册表的文件名。
Regpath:用来指定要导出哪个注册表的分支,如果不指定,则将导出全部注册表分支。
如果打算将保存在C:\Windows\System.dat和保存在C:\Windows\Profiles\User.dat中所有HKEY_CLASSER_ROOT根键下的分支导出到file.reg中,可以执行如下命令:Regedit /L:C:\Windows\ /R:C:\Windows\Profiles\ /e file1.reg HKEY_CLASSER_ROOT
导入注册表
命令格式:Regedit /L:system /R:user file.reg
参数含义:
/L:system指定System.dat文件所在的路径。
/R:user指定User.dat文件所在的路径。
重建注册表
重建注册表,即重新建立System.dat和User.dat文件。
命令格式:Regedit /L:system /R:user /C file.reg
参数含义:
/L:system指定System.dat文件所在的路径。
/R:user指定User.dat文件所在的路径。
/C:此参数将告诉注册表编辑器,用所指定的.reg文件中的内容重新建立注册表。
如果要用file.reg文件中的内容重新建立整个注册表,并将其保存到C:\Windows\System.dat和C:\Windows\Profiles\User.dat中,可执行命令:Regedit /L:C:\Windows\ /R:C:\Windows\Profiles\ /C file1.reg
删除注册表分支
此命令可以将注册表中的一个子键分支删除。
命令格式为:Regedit /L:system /R:user /D Regpath
参数含义:
/L:system指定System.dat文件所在的路径。
/R:user指定User.dat文件所在的路径。
/C:此参数告诉注册表编辑器,将Regpath所指定的注册表子键分支删除。
恢复注册表
Scanreg.exe可以检查、备份、恢复、修复注册表,此命令存放在“Windows\Command”目录下。
命令格式:Scanreg
参数含义:
/backup参数是备份注册表和相关的配置文件,这些文件分别\windows目录下的System.dat、User.dat、Win.ini、System.ini四个文件,把这些文件压缩成rb——?.cab一个文件,存放在\windows\sysbckup目录下,多次使用此命令会产生多个CAB文件,一般从000开始,系统默认最大备份数为5个。可在\Windows\scanreg.ini文件中对最大备份数进行修改,通过修改“maxbackupcopies=?”的数值即可。
/restore参数是选择一个备份进行恢复注册表,此命令不能在Windows 98环境下执行,必须关机后,重新启动进入纯DOS方式下运行。
/fix参数是修复损坏的注册表,此命令也只能在DOS方式下运行。
/comment=""参数是在备份注册表时增加一些详细的注释到CAB文件中。
恢复遭到破坏的注册表文件,可以使用Scanreg命令进行修复,方法是,首先进入DOS系统操作环境,然后执行以下命令:Scanreg/Restore
此时系统会提示注册表备份情况,包括CAB文件名及备份时间等,用户可以选择要恢复的CAB文件进行恢复。
如果要查看所有的备份文件及同备份有关的部分,可以执行命令:Scanreg /restore /comment
如果注册表有问题,可以使用Scanreg来修复,命令为:Scanreg /fix。
——摘自:中国电脑教育报
Playing with Windows Registry in DOS Environment
By/Red Maple Forest
The Registry Editor can not only run and be used under Windows, but also run in MS-DOS real mode. Sometimes when the registry is damaged and Windows cannot be started, we have to repair or modify the registry in DOS mode. The actual physical files of the registry are System.dat and User.dat, that is to say, the data in the registry is saved in these two files.
Exporting the Registry
This command can realize the backup of the registry file.
Command format: Regedit /L:system /R:user /E filename.reg Regpath
Parameter meanings:
/L: system specifies the path where the System.dat file is located.
/R: user specifies the path where the User.dat file is located.
/E: This parameter specifies that the Registry Editor is to perform the operation of exporting the registry. After this parameter, leave a space and enter the file name for exporting the registry.
Regpath: used to specify which branch of the registry is to be exported. If not specified, all registry branches will be exported.
If you intend to export all the branches under the HKEY_CLASSER_ROOT root key saved in C:\Windows\System.dat and saved in C:\Windows\Profiles\User.dat to file.reg, you can execute the following command: Regedit /L:C:\Windows\ /R:C:\Windows\Profiles\ /e file1.reg HKEY_CLASSER_ROOT
Importing the Registry
Command format: Regedit /L:system /R:user file.reg
Parameter meanings:
/L: system specifies the path where the System.dat file is located.
/R: user specifies the path where the User.dat file is located.
Rebuilding the Registry
Rebuilding the registry means re-establishing the System.dat and User.dat files.
Command format: Regedit /L:system /R:user /C file.reg
Parameter meanings:
/L: system specifies the path where the System.dat file is located.
/R: user specifies the path where the User.dat file is located.
/C: This parameter will tell the Registry Editor to re-establish the registry with the content in the specified.reg file.
If you want to re-establish the entire registry with the content in the file.reg file and save it to C:\Windows\System.dat and C:\Windows\Profiles\User.dat, you can execute the command: Regedit /L:C:\Windows\ /R:C:\Windows\Profiles\ /C file1.reg
Deleting Registry Branches
This command can delete a subkey branch in the registry.
The command format is: Regedit /L:system /R:user /D Regpath
Parameter meanings:
/L: system specifies the path where the System.dat file is located.
/R: user specifies the path where the User.dat file is located.
/C: This parameter tells the Registry Editor to delete the registry subkey branch specified by Regpath.
Restoring the Registry
Scanreg.exe can check, backup, restore, and repair the registry. This command is stored in the "Windows\Command" directory.
Command format: Scanreg
Parameter meanings:
The /backup parameter is to backup the registry and related configuration files. These files are the four files System.dat, User.dat, Win.ini, and System.ini under the \windows directory respectively. Compress these files into a rb-?.cab file and store it in the \windows\sysbckup directory. Using this command multiple times will generate multiple CAB files, generally starting from 000. The system default maximum number of backups is 5. You can modify the maximum number of backups in the \Windows\scanreg.ini file by modifying the value of "maxbackupcopies=?".
The /restore parameter is to select a backup to restore the registry. This command cannot be executed in the Windows 98 environment. It must be shut down and then restarted to enter the pure DOS mode to run.
The /fix parameter is to repair the damaged registry. This command can also only be run in DOS mode.
The /comment="" parameter is to add some detailed comments to the CAB file when backing up the registry.
To restore the damaged registry file, you can use the Scanreg command to repair it. The method is: first enter the DOS system operating environment, and then execute the following command: Scanreg /Restore
At this time, the system will prompt the registry backup situation, including the CAB file name and backup time, etc. The user can select the CAB file to be restored for recovery.
If you want to view all backup files and the parts related to backup, you can execute the command: Scanreg /restore /comment
If there is a problem with the registry, you can use Scanreg to repair it. The command is: Scanreg /fix.
——Extracted from: China Computer Education News
|