![]() |
China DOS Union-- Unite DOS · Advance DOS · Grow DOS --Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum |
| Guest | Log in | Register | Members | Search | China DOS Union |
|
中国DOS联盟论坛 The time now is 2026-08-13 13:11 |
47,811 topics / 349,897 posts / today 0 new / 48,256 members |
| DOS学习入门 & 精彩文章 (教学室) » [Urgent] Help |
| Printable Version 505 / 2 |
| Floor1 damuzhi | Posted 2004-02-20 00:00 |
| 初级用户 Posts 2 Credits 118 | |
|
How can I restore the registry under pure DOS? Please, experts from all sides, help me out. Thanks in advance!
|
|
| Floor2 Kinglion | Posted 2004-02-22 00:00 |
| 铂金会员 Posts 1,924 Credits 5,798 From 金獅電腦軟體工作室 | |
|
Programming the registry under DOS mode
Can you program the registry under DOS mode too? Yes. When your Windows 95/98 cannot boot into the graphical interface because of a registry problem, at that point you can only operate on the registry under DOS. This is because the registry editor Regedit.exe is actually an amphibious program: it can run both under DOS and under Windows 95/98. Many users may already know how to use Regedit under Windows, so to master registry programming under DOS mode, you first need to understand how to use the registry editor under DOS. At the DOS prompt, type the Regedit command and a help screen will appear. This screen gives its command-line parameters and how to use them. Syntax: Regedit filename1 Regedit /C filename2 Regedit /E filename3 Where: /L:system specifies the location of the system.dat file. /L:user specifies the location of the user.dat file. filename1 specifies the filename to import into the registry database. /C filename2 specifies the filename used to create the registry database. /E filename3 specifies the filename of the exported registry file. regpath specifies the starting keyword for exporting the registry file (default is all keywords) Now here are a few examples to explain how to use regedit.exe under DOS. 【Example 1】 Export the system registry database registry to the reg1.reg file. regedit /E reg1.reg 【Example 2】 Use reg1.reg to create the system registry database registry (entire). regedit /C reg1.reg 【Example 3】 Import reg.dat into the system registry database (partial). regedit reg.dat 【Example 4】 Export the keywords starting with CJH from the registry database and name it cjh.reg. regedit /E cjh.reg cjh 【Example 5】 Specify system/dat as stored in D:\PWIN and user.dat as stored in E:\PWIN, and use the reg.dat data file to create a new registry database registry. regedit /L :\PWIN /R:E:\PWIN /C reg.dat With the above knowledge, together with what was discussed in “The ‘Shortcut’ to Programming the Registry” about importing or exporting registry files (*.REG), we can program the registry under DOS mode. Let us still take changing the default open method for “*.txt” files—from “Notepad” to “WordPad”—as an example. First export the “HKEY_CLASSES_ROOT\txtfile” subkey branch at the MS-DOS prompt, that is, execute the command: regedit /E txt.reg HKEY_CLASSES_ROOT\txtfile Then use the DOS EDIT editor to open the txt.reg file for editing: change all occurrences of “C:\\WINDOWS\\NOTEPAD.EXE” to “C:\\WINDOWS\\WRITE.EXE”, save and exit EDIT, then execute the command at the command line: regedit txt.reg and the job is done. Of course, strictly speaking, this is not programming. If you really want to implement it through programming, we can write the above process into a batch file chang.bat: @echo off path=c:\windows;c:\windows\command;c:\dos cls echo Exporting the registry... regedit /E txt.reg HKEY_CLASSES_ROOT\txtfile echo. echo Registry export completed! Press any key to start editing the registry... echo. pause edit txt.reg echo Importing the modified registry... regedit txt.reg echo Congratulations! You have successfully modified the registry under MS-DOS mode! pause cls @echo on By fully bringing out the powerful features of the EDIT editor, as long as we follow the format of the exported registry file, we can modify, delete, or add any subkey in the registry as we wish. If you feel this still is not programmatic enough, you can make use of the advantages of various programming languages under the DOS environment, add an interactive interface, and truly turn this process into a program. The result should be in no way inferior to what can be achieved under Windows using API functions. Interested friends can give it a try. |
|
| Floor3 wphs0326 | Posted 2004-03-17 00:00 |
| 银牌会员 Posts 509 Credits 1,708 From 安徽淮南 | |
|
Would scanreg/restore work?
|
|
|
[ Contact the Union admin team -
中国DOS联盟 -
Standard version ] Sponsored by ifanr Inc | © 2001–2023 |