How to access Windows Registry from DOS?

I need to access registry from DOS, while I boot from DOS bootable disk.
I've searched all the internet, and found only Offline NT Password and Registry Editor, which can not be used in DOS, as I understand.
Also I've found RegView (from many mirrors), which isn't working too (I've tried many instructions).

Is there any easy-in-usage tool, like reg.exe, which is able to load registry hives,
so that I can change registry values?? Or any working instructions ??

Note: I already have a bootable drive, which can read/write to NTFS drives.

Thanks in advance!

  • This isn't much of an answer, but could you use a Windows PE disk instead? You'd be able to load regedit from that.
    – rtf
    Oct 24, 2012 at 14:14
  • 1
    I know how to do it with WinPE, but I need in DOS.
    – Searush
    Oct 24, 2012 at 17:38

3 Answers 3


The Windows registry was created long after DOS was discontinued. As such, there is no native way to do it, and (not surprisingly) there do not seem to be any DOS programs to do it. Aside from perhaps FreeDOS or ReactOS, it is unlikely that anybody will ever bother to write a Windows registry-editor for DOS.

That said, there is a way you can access and even edit the Windows registry from DOS, but it is not pretty. You would have to use a file-editor (edit.com is not going to cut it) to access the registry hive files directly. For example, to access HKLM\Software, you would open C:\Windows\Config\Software, or to access a user’s hive, you would open C:\Users\<username>\NTUSER.dat. And this is all assuming that the Windows system drive is even FAT32 since DOS cannot access NTFS without a special driver, most of which only allow read-only access.

Like I said, this method is not pretty because you would need to be familiar with the raw file-format of the Windows registry, be wary of entries that are visible in the file but marked as deleted, and be incredibly careful making any modifications because doing it like that is super risky. As such, this method is highly unadvised (even I don’t bother with it, and I like to crack everything open to look inside).

A much easier and safer method is to simply copy the hive files to another Windows system and mount them (e.g., reg load hku\zzz x:\ntuser.dat), do whatever you need to, then unmount them (e.g., reg unload hku\zzz), and copy them back.

  • Reg.exe doesn't work in MS-DOS. It uses Windows functions, and cannot be run while booting from MS-DOS boot-disk. Is there any way to run it on DOS? Or is there any version of Reg.exe which can run in DOS??
    – Jet
    Mar 14, 2013 at 13:10
  • 1
    @Jet, I never said that you could use reg.exe from DOS. I wouldn’t be surprised if someone, somewhere at some point did create a Windows registry editor for DOS. I have seen several DOS utilities for some aspects of Windows, but most came out around Win9x, so they tend not to be too useful for Windows XP or 7—they would at best, only partially work. For example, even if there were a DOS registry editor, it would likely only support the Win9x format and not handle Windows XP+ registry specs.
    – Synetech
    Mar 16, 2013 at 0:38
  • 2
    "The Windows registry was created long after DOS was discontinued." - Not true, NT 4.0 and Windows 95 had a registry, DOS wasn't official discontinued until 2000.
    – LawrenceC
    Jul 9, 2014 at 11:52
  • That’s just nitpicking. ◔_◔ DOS was discontinued when they stopped making new standalone versions and switched their focus to Windows only. Yes, it continued to exist even through Windows ME (even though they prevented booting directly into it like with previous Win9x versions), but once Windows 95 came out, they stopped caring about DOS and certainly did not bother to implement a way to access or edit the registry from DOS mode.
    – Synetech
    Jul 22, 2014 at 16:52

DOS was more or less retired by Microsoft in 2000, except for special embedded uses.

Furthermore the NT-based versions of Windows are not based on DOS like 9x/ME, and few if any MSDOS utilities will work with anything NT-based due to the differences in the operating system.

Microsoft introduced Windows PE to support out-of-band rescue and installation use cases; what DOS was used for in the past with Windows 9x/ME. Before this, with XP Microsoft introduced the Recovery Console which was meant to fufill the same recovery role DOS was often used for in the past.

Using pure, actual DOS to repair or rescue a Windows installation hasn't been relevant or really possible for about a decade now unless you're still using Windows 95, 98, or ME.

So I'm extremely sure Microsoft has not developed any tools to access or recover NT-based installations from any pure DOS. Third party utilities may exist, are likely very old and unsupported if they do exist, and may not be reliable due to the fact the internal Windows registry internals are officially undocumented.


Warning: The following article involves editing your system registry. Using the Registry Editor incorrectly can cause serious problems requiring the reinstallation of your operating system. Use the Registry Editor and the following directions at your own risk.


The same REGEDIT that we use in Windows also runs as a DOS program. REGEDIT.EXE supports command line arguments that allow us to do a complete registry rebuild, while leaving the "dirt" and empty spaces behind. We'll eliminate the need to repetitively type commands by creating four batch files that you can carry with you and run from a floppy. For the sake of simplicity, we'll assume that SYSTEM.DAT, USER.DAT, and REGEDIT.EXE reside in the C:\WINDOWS directory. Step one: Remove the ReadOnly and Hidden attributes from SYSTEM.DAT and USER.DAT The first step in rebuilding the Windows registry from DOS is to remove the ReadOnly, Hidden, and System attributes from the SYSTEM.DAT and USER.DAT files. A batch file that allows you to toggle the attributes off and on at will (REGATT.BAT) looks like this: @echo off if not "%1"=="-" if not "%1"=="+" goto INSTRUCT attrib %1r %1h %1s c:\windows\system.dat attrib %1r %1h %1s c:\windows\user.dat goto ENDIT :INSTRUCT echo. echo You must specify a - or + parameter, as in "%0 +" or "%0 -" :ENDIT echo.

To use it, enter the command REGATT - or REGATT + to remove or add the file attributes, respectively.

Here's how REGATT.BAT works:

@echo off: Prevents the lines that follow from being displayed on the screen while the commands are being executed. The "@" prevents "echo off" from displaying.
if not "%1"=="-" if not "%1"=="+" goto INSTRUCT: This makes the batch file look for one parameter and limits the parameter choices to either "-" or "+." If neither is found, the script jumps to the INSTRUCT portion of the batch file. Note the use of the double "equals" signs (==).
attrib %1r %1h %1s c:\windows\system.dat: Runs the "attrib" command on SYSTEM.DAT with either "-r -h -s" or "+r +h +s," depending on the parameter.
attrib %1r %1h %1s c:\windows\user.dat: Runs the "attrib" command on USER.DAT the same as it does for SYSTEM.DAT.
goto ENDIT: Jumps over the INSTRUCT statement since all went well.
:INSTRUCT: Label that identifies this portion of the batch file.
echo.–: Prints a blank line on the screen. Note that there is no space between "echo" and "."
echo You must specify a - or + parameter, as in "%0 +" or "%0 -": Instructions for using the batch file. The %0 is a variable that is automatically replaced by DOS with the name of the batch file you typed on the command line. If you typed regatt in lower case, the line will read "You must specify a - or + parameter, as in regatt + or regatt -." If you change the name of the batch file to "wom.bat" and type WOM in upper case, it will read "You must specify a - or + parameter, as in WOM + or WOM -" without further editing. Neat, huh?
:ENDIT: Label that identifies this portion of the batch file.
echo.: Prints a blank line on the screen before returning to the prompt.

Step two: Create a backup of SYSTEM.DAT and USER.DATThe rebuilding process effectively destroys the current registry. If the rebuild fails (I've seen it happen when the DAT files are badly corrupted), there will be no registry. Having a corrupted registry to restore is better than having no registry at all. To make a backup, we simply copy the "unattribbed" SYSTEM.DAT and USER.DAT files with REGBACK.BAT: @echo off if "%1"=="" goto INSTRUCT copy c:\windows\system.dat c:\windows\system.%1 copy c:\windows\user.dat c:\windows\user.%1 goto ENDIT :INSTRUCT echo. echo You must enter a 1 to 3 character file extension, as in "%0 sav" :ENDIT echo.

Most of the lines in REGBACK.BAT are similar to those in REGATT.BAT. The three unique lines are:

if "%1"=="" goto INSTRUCT: This jumps to the INSTRUCT section if no parameter is given after the "regback" command. Without a parameter, the value of %1 is null, so the statement translates to if ""=="" goto INSTRUCT and, since double-quotes indeed equal double-quotes, the script jumps to give the user instructions.
copy c:\windows\system.dat c:\windows\system.%1: Copies SYSTEM.DAT to SYSTEM.parameter. Be sure to limit your parameter to three allowable DOS characters.
copy c:\windows\user.dat c:\windows\user.%1: Copies USER.DAT to USER.parameter as above.

Step three: Rebuilding the registryDO NOT ATTEMPT TO RUN THESE COMMANDS UNLESS YOU HAVE MADE BACKUP COPIES OF SYSTEM.DAT AND USER.DAT! Remember, you will destroy the existing copy of the registry in the rebuilding stage. If the rebuild fails, so will you. Be sure you have your own backup. REGREBLD.BAT looks like this: @echo off echo. echo Exporting registry contents. Please wait... regedit /l:c:\windows\system.dat /r:c:\windows\ user.dat /e c:\windows\newreg.reg echo Rebuilding the Windows registry. Do not interrupt! regedit /l:c:\windows\system.dat /r:c:\windows\ user.dat /c c:\windows\newreg.reg echo. del c:\windows\newreg.reg echo.

REGREBLD.BAT takes no parameters. Here's what the crucial lines do:

echo Exporting registry contents. Please wait...: The REGEDIT "export" command displays no information while it's executing. This is a courtesy line to let you know that something is happening.
regedit /l:c:\windows\system.dat /r:c:\windows\user.dat /e c:\windows\newreg.reg: Exports the contents of the current registry to a file we'll call "newreg.reg." The "/l:" and "/r:" switches point to the exact paths of SYSTEM.DAT and USER.DAT, respectively. The "/e" switch is for "export" and "c:\windows\newreg.reg" is the name of the target file that is created during the process.
echo Rebuilding the Windows registry. Do not interrupt!: Another courtesy statement. Unlike the "export" command, the REGEDIT "create" command displays a progress counter. However, it doesn't state what it's creating, only that it’s importing.
regedit /l:c:\windows\system.dat /r:c:\windows\user.dat /c c:\windows\newreg.reg: Creates a new registry from the contents of "c:\windows\newreg.reg." The key here is the "/c" switch, for "create." As soon as it is encountered, the current SYSTEM.DAT and USER.DAT are destroyed as new files are created from the data in newreg.reg. If this process is interrupted, the new registry will be incomplete and, therefore, useless.
echo.: The progress counter that is displayed by REGEDIT does not have a carriage return. This statement forces one at the completion of the "create" process.
del c:\windows\newreg.reg: Deletes the now unnecessary newreg.reg data file. You can remove this line if you want to look at the contents of newreg.reg before you delete it manually.

The full export/create routine can be quite time-consuming, depending on the size and state of the current registry. I've seen it take anywhere from five minutes to over an hour to rebuild the registry on desktop PCs. I don't recommend using it on laptops. If the rebuilding is successful (and most of the time it is), you won't need the next step.

Step four: Restoring a failed rebuild Step four involves returning the registry to its previous state in the event a failed rebuild leaves you without working SYSTEM.DAT and USER.DAT files. We'll call this batch file REGRET.BAT. Remember the extension you used when creating your backups? You'll need it here: @echo off if "%1"=="" goto INSTRUCT if not exist c:\windows\system.%1 goto NOFILE if not exist c:\windows\user.%1 goto NOFILE attrib -r -h -s c:\windows\system.dat attrib -r -h -s c:\windows\user.dat del c:\windows\system.dat del c:\windows\user.dat copy c:\windows\system.%1 c:\windows\system.dat copy c:\windows\user.%1 c:\windows\user.dat goto ENDIT :NOFILE echo. echo Cannot locate one or more of your "%1" backup files! echo Please verify your file extension and try again. goto ENDIT :INSTRUCT echo. echo You must give a valid backup file extension, as in "%0 ext" :ENDIT echo.

REGRET.BAT runs by entering “regret ext” at the prompt, where “ext” is the extension you used when creating your backups. If the ext files aren’t found, REGRET tells you. All of the REGRET commands are similar to ones we've used in the previous batch files. Note that after we delete the failed SYSTEM.DAT and USER.DAT files, we copy the backups to the DATs as opposed to renaming the backups. I never feel comfortable deleting critical backup files until I'm absolutely sure they won't be needed again. Delete them manually when you are comfortable.

Use what you’ve learned Now that you have your batch files, go ahead and try them on a sick system. Boot the PC to a true DOS "Safe mode command prompt only" and run the files from a floppy. If you make the floppy bootable, be sure that you have an AUTOEXEC.BAT that contains a path statement pointing to C:\WINDOWS;C:\WINDOWS\COMMAND. A successful rebuilding of the registry will solve many of your "mysterious" Windows problems, including many Windows protection errors.

Source: TechRepublic

  • 1
    I've heard about it. But when I try to use my Regedit(of Win7),it says: "This program cannot be run in DOS mode". Maybe other versions are able to do it??
    – Searush
    Oct 24, 2012 at 17:56
  • 2
    Might have been possible with the Win98 regedit.exe, but I wouldn't even attempt to use it with the registry of any modern Windows version.
    – Karan
    Oct 24, 2012 at 22:35

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .