China DOS Union

-- Unite DOS · Advance DOS · Grow DOS --

Union site: www.cn-dos.net Forum site: www.cn-dos.net/forum
DOS stands for freedom, openness and progress. Let us work hard, learn from the openness and GNU spirit of FreeDOS and Linux, and together build and grow a free GNU GPL world!

中国DOS联盟论坛
The time now is 2026-08-13 12:02
Original Poster Posted 2004-02-20 00:00 ·  中国 湖南 湘潭 电信
初级用户
Credits 118
Posts 2
Joined 2004-02-20 00:00
22-year member
UID 17989
Gender Male
Status Offline
How can I restore the registry under pure DOS? Please, experts from all sides, help me out. Thanks in advance!
Floor 2 Posted 2004-02-22 00:00 ·  中国 辽宁 沈阳 联通
铂金会员
★★★★
痴迷DOS者
Credits 5,798
Posts 1,924
Joined 2003-06-20 00:00
23-year member
UID 5583
Gender Male
From 金獅電腦軟體工作室
Status Offline
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.
熟能生巧,巧能生精,一艺不精,终生无成,精亦求精,始有所成,臻于完美,永无止境!
金狮電腦軟體工作室愿竭诚为您服务!
QQ群:8393170(定期清理不发言者)
个人网站:http://www.520269.cn
电子邮件:doujiehui@vip.qq.com
微信公众号: doujiehui
Floor 3 Posted 2004-03-17 00:00 ·  中国 安徽 淮南 电信
银牌会员
★★★
爱DOS但不迷DOS
Credits 1,708
Posts 509
Joined 2004-02-25 00:00
22-year member
UID 18460
Gender Male
From 安徽淮南
Status Offline
Would scanreg/restore work?
°·.∴▍★∴ 我们的泰坦尼克.....
   I l☆ve you!
☆.°·▍▍.☆█☆.°★ 永不会沉没.
◥█▅▅██▅▅██▅▅▅▅███◤
我的主页:http://wphs.ik8.com我的网络硬盘:wphs.ys168.com
Email:wphs@ah163.com QQ:43500498(附加消息:中国DOS联盟)
Forum Jump: