Using PKzip and PKunzip - The Basics

by Brock Wood

Last Updated: October 26, 1998

NOTE: This web site has been replaced by a new site that is designed for users of Windows 95/98/NT. The new site can be found at: http://www.eurekais.com/brock/aazip.htm.


Table of Contents


Introduction: About This Tutorial

So you want to know more about using pkzip to compress files into "ZIP" format archive files? Well, you have come to the right place. As you probably already know, the ZIP format is the most popular format for compressing files on an IBM PC. "Pkzip" is a DOS program that will compress files into a ZIP archive file, saving valuable disk space. If you intend to transfer the ZIP file by modem, you also save valuable on-line time. The companion program, pkunzip, will extract the original files from a ZIP file. Many files that are available for download on the internet are stored as ZIP files to minimize your download time.

In this tutorial, I will explain how to do the four tasks most people want to accomplish with PKzip/PKunzip:

  • Compress files into a ZIP archive
  • Extract files from a ZIP archive
  • Create a ZIP archive that spans multiple floppy disks
  • Convert a ZIP file into a "self-extracting" .EXE file
Note: This tutorial is easiest to use if you print it out first.

Part 1. Downloading and Installing PKzip and PKunzip

Unless you have it installed on your computer already, the first thing you need to do is to download the PKzip for DOS package, version 2.04g, to your hard drive. PKzip version 2.04g is available in a self-extracting file named pkz204g.exe. You can download the pkz204g.exe file (approximately 200K) from this web site:
http://ccic.ifcss.org/ftp-pub/software/dos/utils/
If you couldn't get the file from the above site, try this one:
ftp://coos.dartmouth.edu/pub/dos/Tools/
It might be easier to download the file if you hold down the SHIFT key and then left click on one of the above links. Or you can try RIGHT clicking on one of the above links. When prompted by your web browser program, save the file to your hard drive.

Now you need to go to the DOS prompt for a while. In Windows 3.1, double click on the "MS-DOS" icon in the "Main" group. In Windows 95, click on "Start," "Programs," and "MS-DOS Prompt."

Are you at the DOS prompt? Good. Now, did you remember where the pkz204g.exe file downloaded to? No? If not, it is not a big problem. Just go to the root directory of your hard drive and do a search for it:

c: [ENTER]
cd\ [ENTER]
dir pkz204g.exe /s [ENTER]
The "dir /s" command will tell you the directory to which you downloaded pkz204g.exe. (If you downloaded it to a drive other than C:, substitute the appropriate drive letter for the "C:" in the command above). Jot down the "Directory of" result from the "dir /s" command on a piece of paper. Now, let's create a new directory on the C: drive for the pkzip and pkunzip files:
md c:\zipstuff [ENTER]
The "md" command, above, creates a new directory called "zipstuff" in the root directoy of the C: drive.

Now, copy the pkz204g.exe file into the c:\zipstuff directory:

copy [directory path]\pkz204g.exe c:\zipstuff [ENTER]
Substitute the name of the directory path to which you downloaded pkz204g.exe for "[directory path]" in the command above. For example, if you downloaded pkz204g.exe into "c:\mystuff\download", then substitute "c:\mystuff\download" for "[directory path]".

Now, let's change to the c:\zipstuff directory using the "cd" command:

cd\zipstuff [ENTER]
Run pkz204g.exe to extract the pkzip and pkunzip program files:
pkz204g [ENTER]
When you run pkz204g.exe, you should see several files extract themselves into the c:\zipstuff directory. Now you need to copy three files, "pkzip.exe," "pkunzip.exe," and "zip2exe.exe," to a directory in your system "path." The reason you want to put these files into a directory in your path is that, when they are in a directory in your path, you can use them from anywhere on your system. Normally, the "c:\windows" directory is in your path, so we'll copy the files there:
copy pkzip.exe c:\windows [ENTER]
copy pkunzip.exe c:\windows [ENTER]
copy zip2exe.exe c:\windows [ENTER]
If the "c:\windows" directory doesn't work, you can try the "c:\dos" directory (DOS-only system) or the "c:\windows\command" directory (Windows 95 system).

Great! You have successfully installed the pkzip and pkunzip program files onto your hard drive!


Part 2. Zipping Up a ZIP File with PKzip

Now you are ready to starting creating ZIP files! Let's make a new directory and copy a few files into it so that you can experiment with pkzip:
md c:\ziptest [ENTER]
copy c:\windows\*.ini c:\ziptest [ENTER]
The copy command, above, copied all the files ending in .INI from the c:\windows directory into the c:\ziptest directory. Now, let's go into the c:\ziptest directory:
cd\ziptest [ENTER]
Let's zip up all of those .INI files into a ZIP archive file called "first.zip". To do that, we use the pkzip program:
pkzip first.zip [ENTER]
Using a "dir" command to see a list of the files in the c:\ziptest directory, you can see that a new file, "first.zip," has been added to the directory:
dir [ENTER]
See it? Good. The first.zip file contains all of the .INI files that are in this directory. The files are stored in compressed form - they take up much less space when stored in the first.zip file than when they are stored individually in the directory.

Let's clean up by deleting all of the .INI files in this directory using the "del" command:

del c:\ziptest\*.ini [ENTER]
All that's left in the directory is the first.zip file. Let's do a "dir" command to confirm that:
dir [ENTER]
Congratulations! You just created your first ZIP file! Consider yourself a bona fide "hacker"!

Part 3. Unzipping a ZIP File with PKunzip

Now, let's "unzip" the first.zip file using pkunzip. All of the .INI files will be extracted from the first.zip file back into the c:\ziptest directory:
pkunzip first.zip [ENTER]
Do another dir command and you can see that the .INI files are back!
dir [ENTER]
Neat, huh? The easiest way to unzip a ZIP file that is on a floppy disk is to first create a new directory on your hard drive for the ZIP file and then copy it to the new directory. When you unzip the ZIP file, the resulting files are extracted into a new directory you created expressly for that purpose and don't get mixed up with other files that are already on your hard drive.

Part 4. Putting a ZIP File onto Multiple Floppy Disks

Now let's learn how to use pkzip to create a ZIP file that spans multiple floppy disks. Change to a directory that has at least 3 to 5 megabytes of files in it (the c:\windows directory is a good choice):
cd\windows [ENTER]
In the c:\windows directory, you will probably find several megabytes of .EXE files. We can zip up all of these .EXE files and put the resulting ZIP file onto multiple floppy disks. The key is to use the pkzip program with the "-&" switch:
pkzip a:\allexe.zip *.exe -& [ENTER]
You may need to feed several blank, formatted floppy disks into the A: drive! If you run out of disks, just press "Ctrl-C" to cancel the zipping operation.

In the example above, you specified that you wanted to create a new .ZIP file named "allexe.zip" on the A drive. The "*.exe" portion of the command told pkzip to include only .EXE files in the new ZIP file. The "-&" portion of the command told pkzip that allexe.zip might span multiple floppy disks.

Pkzip can compress most program files, such as .EXE, .COM, and .DLL files by about 50 percent. When compressing text files, such as .INI and .TXT files, pkzip can sometimes compress the file by 80 to 90 percent!


Part 5. Making Self-Extracting ZIP Files

If you are giving a compressed ZIP format file to another person who will be responsible for unzipping it, you might want to give the person a "self-extracting" ZIP file. A self-extracting ZIP file is just a regular ZIP file that has been converted to a .EXE file. When you run the .EXE file, the compressed programs are extracted. This eliminates the need to give the recipient a copy of pkunzip with the ZIP file (as well as the need to teach the recipient how to use pkunzip). In fact, the pkz204g.exe file, which contains the pkzip and pkunzip program files, is a self-extracting ZIP file!

To create a self-extracting ZIP file, you must first create a normal ZIP file. Then you run the zip2exe program on the ZIP file and a self-extracting file is created.

Let's use the the first.zip file we created in part 2, above, as our example. First, we need to change to the the c:\ziptest directory (if you aren't in it already):

cd\ziptest [ENTER]
To convert first.zip to a self-extracting ZIP file, use this command:
zip2exe first.zip [ENTER]
Do a dir command to see the resulting .EXE file, "first.exe":
dir [ENTER]
To extract the files from first.exe, just run the file:
first [ENTER]

Finis: For More Information

Well, now you know the basics of PKzip and PKunzip. If you need further help with PKzip and PKunzip, there is a manual you can consult. It is in a text file called "manual.doc" that comes with the pkz204g package. It should have been extracted into the "c:\zipstuff" directory that we created in part 1 of this tutorial. You can open manual.doc with your favorite text editor or word processor and read it and/or print it out.

Happy ZIPing!

- Brock Wood


Go to All About ZIP Files Page
Back to Download Games Now
Go to Brock's Home Page

This web page is Copyright © 1996-2000 by Brock Wood, all rights reserved.
Questions? Comments? Suggestions? Send e-mail to: bwood@eurekais.com