Can the registry be programmed in DOS mode? Yes. When your Windows 95/98 cannot start to the graphical interface due to registry issues, you can only perform surgery on the registry under DOS. Because the Registry Editor is actually a bi-type program, it can be run on DOS or Windows 95/98. Many users may already know how to use Regedit on Windows. Therefore, to master the programming of the registry under DOS, you must first understand how to use the registry editor under DOS.
Type the Regedit command at the DOS prompt and a help screen will appear. This screen gives its command line parameters and how to use it.
grammar:
Regedit [/L:system] [/R:user] filename1
Regedit [/L:system] [/R:user] /C filename2
Regedit [/L:system] [/R:user] /E filename3 [regpath]
in:
/L:system Specifies the storage location of the file.
/R:user Specifies the storage location of the file.
filename1 Specifies the file name to introduce the registry database.
/C filename2 Specifies the file name that forms the registry database.
/E filename3 Specifies the file name for exporting the registry file.
regpath Specifies the start keyword for exporting the registry file (default is all keywords)
Let me give you a few examples to illustrate how to use it in DOS.
[Example 1] Export the system registry database registry to a file.
regedit /E
[Example 2] Form the system registry database registry (all).
regedit /C
[Example 3] It will be introduced into the system registry database (partial).
regedit
[Example 4] Export the keywords starting with CJH to the registry database and name them.
regedit /E cjh
[Example 5] Specify system/dat to be stored in D:\PWIN and E:\PWIN to form a new registry database registry.
regedit /L:D:\PWIN /R:E:\PWIN /C
With the above knowledge, combined with the import or exported registry files (*.REG) mentioned in "Shortcuts for Programming Registry", we can program the registry in DOS mode.
Let’s take the example of changing the default opening method of the “*.txt” file - "Notepad" to "Writing Board". First, export the subkey "HKEY_CLASSES_ROOT\txtfile" branch at the MS-DOS prompt, that is, execute the command:
regedit /E HKEY_CLASSES_ROOT\txtfile
Then use the EDIT editor under DOS to open the file and edit it: Change all "C:\\WINDOWS\\" in it to "C:\\WINDOWS\\", save the disk and exit EDIT, and then execute the command on the command line:
regedit
Then the work was done.
Of course, strictly speaking, this is not programming. If you have to program and implement it, we can write the above process into a batch of processing files:
@echo off path=c:\windows;c:\windows\command;c:\dos cls echo Exporting the registry…… regedit /E HKEY_CLASSES_ROOT\txtfile echo. echo Registry export completed!Press any key to start editing the registry…… echo. pause edit echo Importing the modified registry…… regedit echo Congratulations!existMS-DOSThe registry was successfully modified under the method! pause cls @echo on
To give full play to the powerful functions of the EDIT editor, we can modify, delete or add any subkey to the registry as we wish while following the format of the exported registry file. If you think this is not programmatic enough, you can take advantage of the advantages of various programming languages in the DOS environment, plus the interactive interface, and truly programmatic this process should be no less than the effect of using API functions in Windows. Interested friends can give it a try.