RegEdit on files from another system

Posted on 2003-11-29
Last Modified: 2013-12-29
A friend of mine has his PC infected with a virus that prevents Regedit to run, in stead it asks for a location of a (deleted) worm.
I know more or less which registry keys should be deleted, but i can't run regedit on his PC.

I wonder if it is possible to copy the user.dat and system.dat to temporary directory on a clean system, and open those files with regedit (or maybe another registry editor) on the clean system, in order to remove the registry-keys that make the virus work, and then copy the cleaned user.dat and system.dat back to the original system.

Question by:sybe
  • 2
  • 2
  • 2
  • +4
LVL 24

Accepted Solution

R_Rajesh earned 125 total points
ID: 9842269
Hi sybe,

try renaming regedit.exe to then run it from dosprompt


LVL 97

Expert Comment

ID: 9842657
Greetings, sybe!

Here is a vbs script for unlocking the registry

If the above does not work, try using this vbs fix. copy the following text into a notepad window. Then click file save as, then click save as file type, choose all files, make sure you give it a .vbs extension. The source is very easy to read and understand so here it goes.

on error resume next

dim shell
set shell = wscript.createobject("")

testHKCU = shell.regread("HKCU\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools")
testHKLM = shell.regread("HKLM\Software\Microsoft\Windows\CurrentVersion\Policies\System\DisableRegistryTools")
if testHKCU or testHKLM = 1 then
result1 = msgbox("Editing the registry has been disabled"&vbcrlf&"Would you like to enable registry editing?"&vbcrlf&"This script can be rerun to both enable and disable registry editing",vbyesno,"Registry Buddy")
    if result1 = vbyes then
    end if
result2 = msgbox("Editing the registry is currently enabled"&vbcrlf&"Would you like to disable registry editing?"&vbcrlf&"This script can be rerun to both enable and disable registry editing",vbyesno,"Registry Buddy")
    if result2 = vbyes then
    end if

end if


Best wishes, war1
LVL 28

Author Comment

ID: 9842733

Thanks, yes, I learned that i can run regedit from the command prompt after starting up in DOS-mode. Then it functions as a DOS program. And it has the possibility to edit other registry file then the standard registry files.
I found out that it is possible to use dos-regedit to export (parts of) the registry to a text file, so that i can read the registry.
The export-file is too big to be read completely in the dos Edit command, but it helps a lot.

It is however not completely what i want, but it comes very close. If no better answer comes up, you get the points.
- - - - -

The problem is not that the registry file is locked, but that in the registry the [HKEY_CLASSES_ROOT\exefile\shell\open\command] (and also for other executables) has been changed to start up the virus in stead of the requested program. The problem caused by this is that no program will start, including regedit.exe.

I looked at the vbs approach a bit, that can also change registry values. The point is that I want to do it from a machine started up in DOS mode. I don't know if it is possible to run vbs from DOS-mode (not a DOS box).

- - - - -

I decided this time to reinstall windows, because it took too much time to find and test the methods to read and edit the registry from DOS mode. I have come a lot closer, and next time i will be better prepared to solve such problems without reinstall. And there will be a next time i am quite sure, too many people still aren't carefull with emails containing virusses.

I will be delighted if someone points me to some methods to read and edit the registry from DOS mode in an easy way.
Maybe someone knows a website about this.

Don't miss ATEN at NAB Show April 24-27!

Visit ATEN at NAB Show to learn how our "Seamlessly Entertaining" solutions deliver fast, precise video streaming without delays for the broadcasting and media environment. ATEN will showcase its 16x16 Modular Matrix Switch (VM1600) and KVM Over IP Solution (KE6900 series).

LVL 24

Expert Comment

ID: 9842880
hi  sybe,

the reason i asked you to rename regedit was because sometime back i ran in to a similar problem because of a virus called sircam32 infact it modified the exact registrykey you mentioned. i wasn't able to execute any exe files on the computer and by remaming the the regedit.exe or regedit32.exe , i dont remember which, to a com extention, i was able to edit the registry under windows gui mode.

Expert Comment

ID: 9843094
IRC/Stages.worm, Life_Stages Worm, VBS_Stages.A, Bloodhound.VBS.Worm

SARC has developed a free, downloadable tool to repair the damage done by the worm. Please go to:
LVL 41

Expert Comment

ID: 9843580
first renaming regedit.exe to should work, but if not try resplendant registrar
LVL 38

Expert Comment

ID: 9844195
Just for your information, sybe, Windows can run .vbs scripts or .wsh (windows script host) scripts in one of 2 ways:

Windows Mode: c:\windows\WScript.exe

DOS Mode:  C:\windows\command\cscript.exe

Options are the same for both.  If the Windows Scripting Host has been installed (not done by default in standard Windows setup), then Wscript.exe is the default and you need to use the appropriate switch to make Cscript.exe the default).

Usage: CScript scriptname.extension [option...] [arguments...]
usage: WScript scriptname.extension [option...] [arguments...]


 //B             Batch mode: Suppresses script errors & prompts
 //D             Enable Active Debugging
 //E:engine       Use engine for executing script
 //H:CScript       Changes the default script host to CScript.exe
 //H:WScript       Changes the default script host to WScript.exe
 //I             Interactive mode (default, opposite of //B)
 //Job:xxxx       Execute a WS job
 //Logo       Display logo (default)
 //Nologo       Prevent logo display at execution time
 //S             Save current command line options for this user
 //T:nn       Maximum time a script is permitted to run
 //X             Execute script in debugger
LVL 38

Expert Comment

ID: 9844211
I'm not sure whether you are aware of how to delete keys or DataValues using a .reg file run from the command REGEDIT /S  [Drive:\] [path\] [filename.reg]

To delete a key, in this case the final part after the last \  place a minus sign at the start of the "path" eg.


deletes the sub-key "TextViewer"  and then the "Microshit" key
(yes, I know, I edited the file's properties in a hex editor and it created that key :-)

To delete DataValues, place a minus sign after the =  eg:


Just an example, you understand.

Expert Comment

ID: 9866076
The symptoms you describe are very similar to those displayed by a system infected with the swen virus.

The fix for this is to create a batch file and a regedit file on floppy on an uninfected machine and run them on the infected one.

Here are the details:-

Batch file - Regfix.bat

@Echo on
cd c:\windows
regedit /e backup.reg  hkey_classes_root\exefile
regedit /d hkey_classes_root\exefile\shell\open\command
regedit /d hkey_classes_root\regfile\shell\open\command
regedit RegEd1.reg

Regedit file - RegEd1.reg


@="\"%1\" %*"

@="regedit.exe \%1\"

On your machine, use notepad or similar to copy the lines above to create the two files and put them on a floppy disk.
On your friends machine, startup with the command prompt only, insert the floppy, type A: <Enter> Regfix <Enter>

This will remove the problem of being unable to run executables and the registry editor.

When the process has finished, reboot the machine and run an anti-virus scan using up-to-date definitions.  Take appropriate action to remove the virus and other unwanted effects.

Symantec have a removal tool for the swen virus, if that's what the problem is. (

Usual warnings about messing with the registry! Plus usual disclaimers.

John T

LVL 28

Author Comment

ID: 10070129
yep, i forget about this question being still open, sorry, arranging now....

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

NTFS file system has been developed by Microsoft that is widely used by Windows NT operating system and its advanced versions. It is the mostly used over FAT file system as it provides superior features like reliability, security, storage, efficienc…
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
With the advent of Windows 10, Microsoft is pushing a Get Windows 10 icon into the notification area (system tray) of qualifying computers. There are many reasons for wanting to remove this icon. This two-part Experts Exchange video Micro Tutorial s…

713 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question