Can the registry can program a registry under the MS-DOS mode? Yes it is. When your Windows 95/98 cannot start to the graphical interface due to the registry problem, you only have surgery for the registry under DOS. Because the registry editor regedit.exe is actually a bisens of programs, they can be run under DOS or running under Windows 95/98. Many users may already know how to use Regedit under Windows, then master the programming of the registry under the MS-DOS mode, first understand how to use the Registry Editor under DOS.
Type a regedit command at the DOS prompt, a help screen will appear. This screen gives its command line parameters and its usage methods.
Syntax: regedit [/ l: system] [/ r: user] filename1
Regedit [/ L: System] [/ R: user] / c filename2
Regedit [/ l: system] [/ r: user] / e filename3 [regpath]
among them:
/ L: system specifies the storage location of the System.dat file.
/ L: User specifies the storage location of the user.dat file.
FILENAME1 specifies the file name that introduces the registry database.
/ C filename2 Specifies the file name to form a registry database.
/ E filename3 Specifies the file name that exports the registry file.
RegPath Specifies the start keyword exported to the registry file (default is all keywords)
A few examples of the use of regedit.exe under DOS.
[Example 1] Export the system registry database REGISTRY to the reg1.reg file.
Regedit / e reg1.reg
[Example 2] Reg1.REG forming system registry database Registry (all).
Regedit / c reg1.reg
[Example 3] introduce the reg.dat into the system registry database (part).
Regedit reg.dat
[Example 4] Export the keyword starting with CJH to the registry database and name CJH.REG.
Regedit / E CJH.REG CJH
[Example 5] Specify SYSTEM / DAT storage in D: / PWIN and user.dat stores in E: / PWIN, forming the REG.DAT data file to form a new registry database REGISTRY.
Regedit / L: D: / PWIN / R: E: / PWIN / C REG.DAT
With these knowledge, combined with the "shortcut", "shortcuts", "shortcuts", which is programmed to the registry, and we can program the registry in the DOS mode. .
We still turn on the default open mode of the "* .txt" file - "Notepad" as an example. First, the branch of the "HKEY_CLASS_ROOT / TXTFILE" subkey is exported at the MS-DOS prompt, that is, execute the command:
Regedit / E TXT.REG HKEY_CLASS_ROOT / TXTFILE
Then open the TXT.REG file with the EDIT editor under DOS: All "C: //windows/notepad.exe" is all changed to "c: //windows//write.exe", the deployment exits Edit, then execute the command on the command line:
Regedit TXT.REG
I have already gone.
Of course, strict, this is not programmed. If you must be programmed, we can write the above process into a batch of processed files chang.bat:
@echo offath = c: / windows; c: / windows / command; c: / dosclsecho is exporting registry ... regedit / e txt.reg hkey_classes_root / txtfileecho.echo registry exported! Edit the registry by pressing any button ... echo.pauseEdit Txt.Regecho is importing the modified registry introduced ... regedit txt.Regecho Congratulations! Successfully modified registry in MS-DOS mode! Pausecls @ echo ON fully exerts powerful features of Edit Editor, we can Under the premise of following the format of the exported registry file, the registry is modified, deleted, or increasing any of the restings. If this is not programmed, you can play the advantages of various programming languages in the DOS environment, plus interactive interfaces, truly programmed this process, should not be asked in Windows states using API functions Effective results. Interested friends can try it. If you have any questions about this, please contact me (Bacalpdc@sohu.com).
"Shortcut" 2001-09-29 · · · - ·· Yesky we know, in VB, you can use the shell function to perform an executable file. The access to the registry can be easily contacted with the regedit.exe command to contact a text file. In this way, we don't have to master the deep API function, you need to program the text file to process it. First, the key values of each primary key and subkey in the registry, generally have the following types: 1REG_SZ (normal string) 2REG_EXPAND_SZ (can be expanded) 3REG_BINARY (binary) 4REG_DWORD (long integer type, 16 Value). They do not have the same form in the exported registry file. See later after specific examples. Second, let's familiarize yourself with the usage of the regedit command and related parameters: regedit filename1 regedit / e filename3 [regPath1] regedit / d regPath2 filename1 Specifies the file to be entered into the registry. / E filename3 Specifies the output file name of the registry. RegPath1 specifies the key name of the registry to output (default to output the entire registry) / dregPath2 specifies the file that is exported or imported in the key name of the registry to be deleted. The format is as follows: (Note in small brackets, ... indicating that there is omitted) regedit4 (must start, pay attention to case) [HKEY_LOCAL_MACHINE / SOFTWARE] (each subkey must be empty between the previous sub-key, and The sub-key is enclosed in []) @ = "" (@ 表示 表示 值 值 "name" default ", key value is empty string) ... ...... [HKEY_LOCAL_MACHINE / SOFTWARE / Microsoft / Windows / CurrentVersion]" InstallType "= HEX: 03,00 (indicating the key name "installtype", the key value is REG_BINARY (ie binary) type 03 00) "DevicePath" = "c: // windows // inf" is a normal string, iereg_sz Type. When the string contains special characters such as path "/", the agreement is replaced with "//" instead of the carriage return and "character) with" / n "and" / "" ... ...... HKEY_LOCAL_MACHINE / Software / Microsoft / Windows / CurrentVersion / Setup / SetupX / Cert] "RG2CATDB Return" = dword: 00000000 (dword: indicates that the key REG_DWORD (long integer that hexadecimal value) [HKEY_LOCAL_MACHINE / Software / Microsoft / Windows / currentversion / ms-dosoptions / smartdrv] ... ... "autoexec.bat" = "loadinghigh% windir% // smartdrv" (containing a pair of strings are expandable strings, iereg_expand_sz type, this % Windir% means Windows working directory), for example: the following code can be modified to string with the default value of the specified sub-key path [HKEY_MACAL_MACHINE / SOFTWARE]: "This value has been modified!"
Stt = "hkey_local_machine" A = shell ("Regedit /ec" & attiWindows/temp/temp.txt "& att)" Export To modified registry branch if a = 0 THEN MSGBOX "Export Error!": End 'may be Sub key name Error regPath = "[" stt "]" open "c: /windows/temp/temp.txt" for input as # 1 open "c: /windows/temp/temp1.txt" for output as # 2 regWrite = flase 'Is it to modify the line print # 2, "regedit4"' Write the file header, pay attention to the uppercase Print # 2, "" Do Line Input # 1, AA $ B $ = aa $ if regWrite = TRUE THEN 'Note This trip is a row B $ = "@ =" "default value!" "" "" "" "" "" "Print # 2, B $ MSGBOX" original value is: "& Mid $, 3) & "It is about to be changed to:" & Mid $ (B $, 3), Vbokonly, "Registry Change" end if if et estate # 2, b $ regWrite = true 'Description The next behavior wants to modify In order to make the B $ to modify Else RegWrite = FLASE 'is not modified in the next cycle, END IF' IF LEFT (AA $, 2) <> "@ =" and b $ = "@ =" "The default value has been Modify! "" "" "" "" "" "" "" "" "If the subkey [hkey_local_machine / software] is not set to set the default value, it is equivalent to inserting B $ in file # 1. Loop Until Eof (1) Close a = shell ("regedit c: /windows/temp/temp1.txt") 'Import the modified content into the registry if a = 0 THEN MSGBOX "Modify Failure!": End Press The above ideas, we can easily increase, delete, change, etc. Using Registry Editor under DOS
The Registry Editor Regedit.exe is actually a bisens of programs that can be run under DOS or run under Windows 98. Many users may already know how to use regedit under Windows, then how to use the Registry Editor under DOS? Type the regedit command at the DOS prompt, a help screen will appear. This screen gives its command line parameters and its usage methods. Syntax: regedit [/ l: system] [/ r: user] filename1Regedit [/ l: system] [/ r: user] / c filename2Regedit [/ L: system] [/ r: user] / e filename3 [regpath] : / L: System specifies the storage location of the System.dat file. / L: User specifies the storage location of the user.dat file. FILENAME1 specifies the file name that introduces the registry database. / C filename2 Specifies the file name to form a registry database. / E filename3 Specifies the file name that exports the registry file. RegPath Specifies the start keyword (default to all keywords) for exporting registry files (default to all keywords) Examples of the use of regedit.exe under DOS. [Example 1] Export the system registry database REGISTRY to the reg1.reg file. Regedit / e reg1.reg
[Example 2] Reg1.REG forming system registry database Registry (all). Regedit / c reg1.reg
[Example 3] introduce the reg.dat into the system registry database (part). Regedit reg.dat
[Example 4] Export the keyword starting with CGJ to the registry database and name it CGJ.REG. Reedit / e cgj.reg cgj
[Example 5] Specify SYSTEM / DAT storage in D: / PWIN and user.dat stores in E: / PWIN, forming the REG.DAT data file to form a new registry database REGISTRY. Regedit / L: / PWIN / R: E: / PWIN / C REG.DAT
The following describes how to recover the registry when you appear when you start Windows. 1. First export in security mode, then introduce the registry file (1) After turning off the computer, restart, press the "Starting Windows 98", press the F8 key, select "Safe Mode Command Prompt Only" in the startup menu, The system enters safe mode. (2) Perform the following command: regedit /l:c:/Windows/system.dat / e c: /system.txt (export registry) CD / Windows (windows98 system directory) attrib- -h -r system.dat (Remove System.dat system, implicit, read-only properties) Ren System.dat System.old (renamed the current system.dat file) regedit /l:c:/Windows/system.dat / c: / system.dat / c: / system .txt (introduced registry) (3) Restart your computer, start the Windows98 system in normal way, if the error still appears, can use the following command in safe mode: regedit /l:c:/Windows/user.dat / e c : /user.txt (export registry) CD / WindowsAttrib- S-H -R User.dat, Implied, Read-On Properties) REN User.dat User.old (put the current user. DAT file rename) regedit /l:c:/Windows/user.dat / c :/user.txt (introduced registry) 2. Restart your computer, start the Windows98 system in normal way, if the error still appears, you can restore the system To the last registry that is successfully run. (1) After turning off the computer, restart and enter the security mode. (2) Perform the following command: CD / WindowsAttrib- S-H -R System.Datren System.dat System.bad (3) Restart the Windows 98 system, when starting, if you do not find the System.dat file, you will use it when you start. System.da0 files, the system will automatically rename System.da0 files to System.dat. 3. If there is still a startup error, restore the system to the first successful runtime registry. (1) After turning off the computer, restart and enter the security mode. (2) Perform the following command: CD / windowSattrib -s -h -r system.datren system.dat system.xxxcd attrib--h -r system.1st (this file is usually in C) under the root of the boot disk. /) COPY SYSTEM.LST C: /WINDOWS/System.dat (using system.lst alternative system.dat) Attrib S H R System.lst (plus attribute) 4. Restart Windows98 system, if there is still error, then Reinstall Windows98 system.
Using ScanReg under DOS Using ScanReg /? Commands under DOS, a help information screen appears. This screen will give ScanReg's usage: scanreg / [option] where can Option can be? (Get Help Information), Backup (Backup Registry), Restore, Fix (Repair Registry), Comment The description information is added to the backup registry file. In CAB). For example: 1. Execute scanreg / backup under DOS, back up the registry to the .cab file. 2. Implement ScanReg / FIX, restore the errors in the registry. 3. Execute ScanReg / Restore, recover the registry