TweakHomePC

Dual-booting all versions of Windows and Linux

   Dual-Boot    |    Win 8    |    Win 7    |    Vista    |    Win XP/2K/NT    |    Win9x/Me    |    How to    |    Legacy 9x Tweaks    |    SiteMap   


 

Here: Home > Legacy 9x Tweaks > PC Safety >


RESTORE DELETED FILES

Last reviewed: May 2003

Windows 9x does not boot after deletion of some file(s)

Even the best of users accidentally delete a file into the Recycle Bin. That's not a problem as it can be restored from the Recycle Bin from under Windows or Safe Mode.

However it sometimes happens (once is too often!) that the file deleted is vital to Windows 9x operations. If this is not restored prior to shutdown, then the Windows 9x will not boot again and you are stuck with MS-DOS.

The Recycle Bin is most unfriendly to DOS users.

This page shows you how to restore deleted files from C:\Recycled (that's the Recycle Bin) working in true MS-DOS from a Windows 9x boot disk.

SUMMARY: RESTORE DELETED FILE

Boot with Win9x boot disk to DOS.
Stay at the A:\> Prompt. Press [Enter] after each line.
    ATTRIB -S -H C:\RECYCLED
    ATTRIB -H C:\RECYCLED\INFO2
    ATTRIB -S -H C:\RECYCLED\*.*

    DIR /A /OD /P C:\RECYCLED
Look for most recent deletions (highest DC(numbers) are most recent deleted)
    EDIT /R C:\RECYCLED\INFO2
Search INFO2 for DC. Note the Path & original file Name that come before that DC
Press ALT, then F, then X to exit Edit
    COPY /-Y /V C:\RECYCLED\DC?.xxx PATH\FILENAME.xxx
    ATTRIB +H C:\RECYCLED\INFO2
    ATTRIB +S +H C:\RECYCLED
(note: we rename DC?.xxx as we copy it to its original location).
Example:   COPY /-Y /V C:\RECYCLED\DC29.DAT C:\WINDOWS\SYSTEM.DAT
Be careful with spaces, colons (dot over dot), and slashes (\ or /).
Repeat for other deleted files.
Reboot.
The rest of this page is essential reading.
Restoring a deleted folder, or a file in a deleted folder, is a little different - but read below.

[top of page]

DELETED

In Windows 9x, restoring is just a right-click on a recognized Name.
It's substantially different when C:\RECYCLED is viewed in true DOS.
We see a list of DC(number)s with File Extensions or with <DIR>s.

Example of Recycled

.              <DIR>        02/10/02  11:26 .

.. <DIR> 02/10/02 11:26 ..
DC9 VXD 69,454 11/05/02 20:01 DC9.VXD
DC8 DLL 473,088 05/04/00 2:01 DC8.DLL
DC7 GID 25,211 01/04/03 21:08 DC7.GID
DC6 CFG 364 01/04/03 21:08 DC6.CFG
DC5 <DIR> 01/05/03 10:22 DC5
DC4 TXT 359 30/04/03 20:29 DC4.TXT
DC3 <DIR> 01/05/03 10:01 DC3
DC2 <DIR> 01/05/03 10:36 DC2
DC1 <DIR> 01/05/03 20:29 DC1
DESKTOP INI 65 01/05/03 9:15 desktop.ini
INFO2 8,700 02/05/03 11:07 INFO2

Every deleted File and Folder is renamed DC and given a number, like DC5 or DC9.vxd.
DC means Drive C:. It's DD in D:\Recycled, DE in E:\Recycled.

The number is the order of deletion - highest was deleted last.
A deleted File shows an Extension.
A deleted Folder shows a <DIR>.
Other vital details (Path and File Name) are stored in C:\Recycled\INFO2.
The Date is the file date, not the Date Deleted.

To restore an item, we need the Path and correct Name.
We can view those vital details in INFO2 and then restore any item.
It requires some attention to detail, some recording, and some typing.
1. Examine Recycled.
2. Examine INFO2.
3. Restore deleted item(s) to original location using the Copy command,
    renaming the DC? as we copy it.
    Examples are shown below.

Note: Windows 95 uses a INFO which does not have DC?s in it.
Windows 95 users must count them - 1st DC, 2nd DC, 3rd, 4th, and so on.

[top of page]

EXAMINE RECYCLED

VIEW USING RESTDEL.BAT

Users uncomfortable working in DOS can download THPC's Restdel.zip to view the contents of the Recycle Bin from DOS. This batch file, Restdel.bat, shows all files, folders, subfolders and their files, in Recycled including Hidden and System files. It then opens INFO2 in Edit so users can search for a DC? and identify its Path and Name. It also contains all information on this page.

Restdel.bat does not, and can not, copy any file(s) or folder(s). It's a hassle-free way of looking at everything in the Recycle Bin and INFO2. It's ideal for those who are not used to working in DOS.

What Restdel does:
1. Examines root of C: for files required to boot Windows 9x.
2. Examines Windows folder for some files required to boot (only some).
3. Looks for a system backup for possible restoration.
4. Displays the information on this page.
5. Shows the contents of INFO2, or INFO, so the Path and Name of a DC(number) can be located.
6. Shows the contents of Recycled in summary and detailed formats.
7. Shows examples of restoring a file, folder, or folder plus subfolders.

Unzip Restdel.zip to the Win9x boot disk.
To run Restdel.bat, boot with the boot disk and type in - and then press [Enter]
RESTDEL

Download restdel.zip (6 KB, freeware, two files, expands to about 18 KB).

If using Restdel.bat, you can skip to IDENTIFY A DELETED ITEMS:


VIEW MANUALLY

Bootup to DOS using your Win9x boot disk or Startup Disk.

Always press the [Enter] key after typing in any of the lines below.

Type in
EDIT
Press Alt, then F, then X (to exit Edit - we are only testing it for now)

[if Edit did not open for you, then type in
SET PATH=%PATH%;C:\WINDOWS\COMMAND
where C:\WINDOWS is where your Windows is installed
and try EDIT again]

We are back at the A:\ prompt.

This will show the first level (root) of Recycled.
Type in
ATTRIB -S -H C:\RECYCLED
ATTRIB -S -H C:\RECYCLED\*.*
DIR /A /OD /P C:\RECYCLED
(That's the letter O. It's not a zero)

We are viewing a list of the deleted files and folders (DC?s), plus INFO2 and Desktop.ini.

See above for an example of Recycled.

Use DIR /A /OD /P C:\RECYCLED\DC? to show the contents of that folder.
Use DIR /A /OD /P /S C:\RECYCLED\DC? to view contents of all DC?'s subfolders.
Use DIR /A /OD /P /S C:\RECYCLED to view all contents of Recycled itself.
Press the space bar to scroll.

Typing errors and hassle can be avoided by using restdel.zip to examine Recycled and INFO2.
You will still have to do the investigation. and the copying, yourself!

[top of page]

IDENTIFY DELETED ITEMS

The numbers in the DC? names are in the order of deletion with the most recently deleted having a higher number in DC?. A DC0 was deleted first, DC1 deleted second, DC2 deleted third, and so on. A DC35 file was deleted more recently that a DC34 file. The DC with the highest number was the last deleted. When we identify the DC? that interests us, we will look in INFO2 to find its correct Name and Path.


IDENTIFY A DELETED FILE:

Identifying the correct DC? can be very important when restoring a file.
1. Recently deleted files will have the highest numbers in the DC? names
2. We may recognize the file extension (a dot followed by three letters),
    like .bin, .com, .dat, .dll, .drv, .exe, .inf, .ini, .vxd, plus many more.
3. We may recognize file size.
4. We may recognize the file date
    (Windows/software files dates, or Windows/software installation dates).
5. We may know the correct name and search in INFO2 for it.
6. If completely lost, we can restore all the most recently deleted file!


IDENTIFY A DELETED FOLDER:

Restoring a deleted folder is usually easier.
1. A deleted folder shows a <DIR> and does not show a file extension or file size.
2. The most recently deleted folder is possibly the one we want.
3. DIR /A /S /OD /P DC? will show us the file contents of DC? folder, and may indicate its name.
4. DIR /A /S /OD /P DC? will likely suggest its original location.
5. We may know the correct name and search in INFO2 for it.
6. If completely lost, we can restore all the most recently deleted folders!

FILES & FOLDERS:

Having identified the likely DC?, we will then examine INFO2 to identify the original name for DC? and also its previous location (path to its drive/folder). We can then COPY the file to its own folder, renaming it to its original name as we do so. For a deleted folder, the original folder must be created first plus any subfolders we want.

[top of page]

EXAMINE INFO2

Skip the next five lines if using Restdel.bat.

Type in
ATTRIB -S -H C:\RECYCLED
ATTRIB -H C:\RECYCLED\INFO2
EDIT /R C:\RECYCLED\INFO2
(there is no file extension)

The file INFO2 opens in Edit.
At first it looks unmanageable! Just ignore those strange characters.
Let's assume we are interested in DC9.

Hold down ALT, and press S (for Search)
Now press F (for Find)
Enter DC9 and press [Enter].

DC9 is found.
Press the right Arrow key four times to make sure any Extension is visible.
The part before DC9 shows what we want (plus some strange characters we can ignore):
1. the correct file name for the file DC9.VXD (which, in our example, would be Vmm32.VXD)
2. the full path from which it was deleted (which, in our example, would be C:\WINDOWS\SYSTEM\VMM32).

It will look something like this in INFO2:
. . . xxxx C:\WINDOWS\SYSTEM\Vmm32.VXD xxxxx C\Recycled\DC9.VXD  xxxx . ..
where the xxxx are strange characters that we totally ignore.
Note: The Path comes before the DC? we are investigating.

In our example, INFO2 shows us that DC9.VXD is actually Vmm32.VXD, and belongs in
C:\WINDOWS\SYSTEM\. Make a note of the full Path, the File Name & Extension, and the associated DC number.

If DC9 were a Folder, there would be no Extension after DC9 or in the Path.

We can repeat the Search for others until we are sure we have all the correct files. If we have no indication at all, we may have to locate that information for all recently deleted files and restore all of them!

When finished, press ALT, then F, then X to exit Edit.
DO NOT Save INFO2 if asked. Leave it unchanged.

[top of page]

RESTORE DELETED ITEMS

There are three stages to restoring:
a) Examine Recycled and identify a likely DC? (described above)
b) Examine INFO2 and locate the Path & Name for that DC? (described above)
c) Restore the deleted item using the Copy command (this section).

Be careful with spaces, colons (dot over dot), and slashes (\ or /).

Below are three examples of restoring.
To adjust these examples for your own use, you must
a) change the sample DC(number) to your own DC?,
b) change the sample Path to the Path for your DC?,
c) change the sample Name to the Name for your DC? (plus .Extension for a File).

FILE RESTORE:

Examine Recycled. Then examine INFO2 in Edit (use Restdel.bat).
Locate the Path and original Name - it comes BEFORE its own DC?.
Accurately RECORD the PATH, ORIGINAL NAME, and ATTRIBUTES for the DC?
(Example: Path=C:\WINDOWS\SYSTEM.DAT, DC9.DAT=SYSTEM.DAT, Attributes=RH).
Use Alt-F-X to exit Edit, and return to the DOS screen.

Type (check your typing and then press [Enter] after each line).
    C:
    CD\
    ATTRIB -s -h RECYCLED
    CD RECYCLED
    ATTRIB -s -h DC9.DAT
    COPY /-y /v DC19.DAT C:\WINDOWS\SYSTEM.DAT
    ATTRIB +h C:\WINDOWS\SYSTEM.DAT
    CD\
    ATTRIB +h C:\RECYCLED\INFO2
    ATTRIB +s +h C:\RECYCLED
(note: we renamed DC9.DAT as we copied it to its correct Path).
If the file does not have Attributes set, the ATTRIB lines 5 and 7 are omitted.

FOLDER RESTORE:

This example will restore a deleted Folder and ALL, or ONE, of its files
(any subfolders in the deleted Folder will not be restored by this):

Examine Recycled. Then examine INFO2 in Edit (use Restdel.bat).
Locate the Path and original Name - it comes BEFORE its own DC?.
(Example: Path=C:\TOP\VITAL, DC9=VITAL, no Extension)
Accurately RECORD the PATH and ORIGINAL NAME.
Use Alt-F-X to exit Edit, and return to the DOS screen.

Type (check your typing and then press [Enter] after each line).
    C:
    CD\
    MD C:\TOP\VITAL
    ATTRIB -s -h RECYCLED
    CD RECYCLED
    ATTRIB -s -h DC9\*.*
    COPY /v DC9\*.* C:\TOP\VITAL\
    CD\
    ATTRIB +h C:\RECYCLED\INFO2
    ATTRIB +s +h C:\RECYCLED
To restore Folder + one file, replace *.* with the FileName.xxx (twice), like
    ATTRIB -s -h DC9\FileName.xxx
    COPY DC9\FileName.xxx C:\TOP\VITAL\

MULTIPLE FILES & SUBFOLDERS:

Avoid using XCopy if at all possible.

XCOPY can be used (reluctantly!) from DOS to restore many subfolders.
XCOPY (DOS 6.2+) does not copy System or Hidden Files.
However, all these Attributes can be removed by a single line in DOS.
But, all Long File Names will be truncated (to 8 characters ending ~1, ~2, etc) and there is no cure for this.

If restoring in this fashion makes Windows bootable, we can then use the
Recycle Bin to restore the folder properly (allow overwriting).

We don't need to recreated the deleted Folder first - XCOPY will do it if
we enter it in the path.

Examine Recycled. Then examine INFO2 in Edit (use Restdel.bat).
Locate the Path and original Name - it comes BEFORE its own DC?.
Accurately RECORD the PATH and ORIGINAL NAME.
(Example: Path=C:\WINDOWS\SYSTEM, DC5=SYSTEM, no Extension)
Use Alt-F-X to exit Edit, and return to the DOS screen.

Type (check your typing and then press [Enter] after each line).
    C:
    CD\
    ATTRIB -s -h RECYCLED
    CD RECYCLED
    ATTRIB -s -h DC5\*.* /s
    XCOPY DC5\*.* C:\WINDOWS\SYSTEM\ /-y /s
    ATTRIB -a C:\WINDOWS\SYSTEM\*.* /s
    CD\
    ATTRIB +h C:\RECYCLED\INFO2
    ATTRIB +s +h C:\RECYCLED
Don't forget to use the /s switch to include subfolders.

[top of page]

NOTE FOR USERS WHO HAVE NO INFO2 IN RECYCLED

SYSTEM FILES DELETED FROM ROOT OF C:\

If we accidentally delete certain files from root of C:\ (active partition), Window 9x will not boot.

Read above if you have INFO2 in Recycled.
If you have no INFO2, or an unmanageable INFO, or no INFO, then continue here.

Our computer will boot to Windows 9x if it has just three correct files in root of C:. When Win9x boots again, any other files can be restored when we are not under any pressure!

The three system files are:
Command.COM, Io.SYS, Msdos.SYS - note those very important file Extensions.

First look in root of C: to see which are missing.
Type in
DIR /A /O /P C:
and look for those three file.
We will presume all three files are missing and we'll look for them in Recycled.
Type in
ATTRIB -S -H C:\RECYCLED
ATTRIB -R -S -H C:\RECYCLED\*.*
DIR /A /OD /P C:\RECYCLED
(That's the letter O. It's not a zero)

First look at the most recently deleted files (highest DC? numbers with a file extension).
See if you can match the file extension and file size to give you the DC? name.

               Win95     Win98     WinSE     WinMe
COMMAND.COM    93,870    93,880    93,890    93,040

IO.SYS 223,148 222,390 222,390 110,080

MSDOS.SYS variable (1,024 to 1,900+, usually around 1,650)
Type in EDIT /R C:\RECYCLED\DC?.SYS and look for something like
[Paths]
WinDir=C:\WINDOWS
WinBootDir=C:\WINDOWS
HostWinBootDrv=C
If it's Msdos.sys, it will start with lines like those.

(95 refers to Win95a. The sizes for Win95b or Win95c (ORS2+) were not checked)

When you locate the correct DC? name, copy the DC?.xxx to C:\, renaming it as you do so.

Example:
Let's say we identify DC27.COM as Command.com, DC26.SYS as Io.sys, and DC23.SYS as Msdos.sys.
We would type in - and press [Enter] after each line
    ATTRIB -s -h C:\RECYCLED
    ATTRIB -s -h C:\RECYCLED\DC26.SYS
    ATTRIB -s -h C:\RECYCLED\DC23.SYS
    COPY /-Y /V C:\RECYCLED\DC27.COM C:\COMMAND.COM
    COPY /-Y /V C:\RECYCLED\DC26.SYS C:\IO.SYS
    COPY /-Y /V C:\RECYCLED\DC23.SYS C:\MSDOS.SYS
    ATTRIB +s +h C:\RECYCLED
    ATTRIB +s +h C:IO.SYS
    ATTRIB +s +h C:\MSDOS.SYS

When your Windows is booting again, you can attend to Config.sys, Autoexec.bat, System.1st (and maybe Classes.1st), Bootlog.txt, Bootlog.prv, and others that belong in root of C:.

[top of page]

Please remember that you alone are responsible for the consequences of any changes you make to your computer hardware or software.

Copyright © LarryM 1998-2015 thpc@mail.com