Microsoft

The Windows EXTRACT command: Useful but potentially dangerous

If you're using the EXTRACT command to manipulate the Windows CAB files, you'll want to read this article. Find out why this helpful tool can be dangerous if not used properly.


The EXTRACT utility (C:\windows\extract.exe) can be a very useful tool for examining the contents of Windows CAB files and copying individual files from the CABs to selected destinations. While EXTRACT is helpful, it is also potentially dangerous.

Create a CAB file listing
Examining the contents of an individual CAB file is easy enough. The following command will create a searchable text file listing of the contents of the desired CAB (substitute “filespec” with the name of the CAB file):
extract /d filespec.cab > filespec.txt

To create a file listing of all CABs in a directory, add the /a switch, the >> append parameter, and begin with the “lowest” CAB file. For example, to create a text listing of all the Win98 SE CABs in C:\WINDOWS\OPTIONS\CABS, switch to the CABs subdirectory and use the command:
extract /d /a base4.cab>>cablist.txt

(base4.cab being the “lowest” CAB file, alphabetically)

The resulting text file will be too big for Notepad to open, but Wordpad or an external utility such as UltraEdit will do just fine.

Not all CABs are created equal
But here’s where EXTRACT can be dangerous. Let’s say you need to restore redir32.exe to your Windows\System directory, but you don’t know in which CAB redir32.exe resides. The following command will search all CABs for redir32.exe and, when found, extract it to your Systems directory:
extract /a base4.cab redir32.exe /l c:\windows\system

No problem. But using this method to extract a fresh copy of USER.EXE can render your Windows system inoperable. That’s because Windows has two versions of USER.EXE in its CABs—one for use during Setup and one for normal operation.

The Setup version of USER.EXE is in MINI.CAB on Win9x systems. The Windows “normal” USER.EXE varies in its CAB location, depending on the Win9x version involved (e.g., for Win98 SE, it’s in Win98_46.cab; for Win98, it’s in Win98_42.cab; for Win95 OSR2, it’s in Win95_04.cab). If you extract the MINI.CAB version of USER.EXE, Windows will not work. To be sure to get the correct version, create a file listing and search for USER.EXE in one of the Win9x_xx.cab files. Note the CAB location and use extract win98_46.cab user.exe (for Win98 SE) to get the file.
Was the information presented in this article useful? Would you like to see more articles like this on TechRepublic? Post a comment or write to John Kowaleski and share your thoughts.

Editor's Picks

Free Newsletters, In your Inbox