Special, Creative ZIP Commands

zip

by M. L. Giggleman

PKZIP: Creating banners that display when unzipping archives

Q: When I unzip archives downloaded from BBS's, the net, etc. there are sometimes "banners" that display. These may be advertisements for the BBS or contain information about the archive. I have even seen text "graphics" used. How do I make one of these?

A: These are created using the "comment" option for PKZIP.

PKZIP has two types of comments: Comments may be embedded (1) within the ZIP file itself or (2) within each file in the archive. It is the first option that creates the "title" or banner page that is displayed when the file is unpacked.

Creating a comment for a ZIP file: The "title pages" that display when you unpack a zipped file are created using the "z" switch. The display text may be entered interactively or by use of a text file. Using a text file allows you to create an informative banner.

The command to add a comment to an archive interactively is: PKZIP -z filename.zip *.*

You will be prompted to type in a comment: PKZIP example2.zip *.* -z

Creating ZIP: EXAMPLE2.ZIP

Zip comment ? Programs one and two with text files. To display the embedded comment, simply PKUNZIP the archive: PKUNZIP example2

Searching ZIP: EXAMPLE2.ZIP - Programs one and two with text files.

Extracting: ONE.TXT

Extracting: TWO.TXT

Inflating: ONE.EXE

Inflating: TWO.EXE

For a larger banner, create a text file using an editor that produces an ASCII text — one without any formatting symbols. The DOS EDIT program is a good example of that type of editor, as is Windows Notepad. Create a multiple line text and save it.

For best results, leave several blank lines at the beginning and end of the comment text. This will separate the comment from the status information normally displayed by PKUNZIP.

For example, I created a file called COMMENT.TXT containing the following (note the blank lines before and after the text):

(blank line here and succeeding examples)

*********************************

PROGRAMS & TEXT FILES

Release 14.b

MLG Solutions, Inc. - March 1997

********************************

ONE.EXE

ONE.DOC

TWO.EXE

TWO.DOC

********************************

(blank line here)

This could also contain the ASCII box-drawing characters, ASCII art, etc.

To embed the comment, use the command: PKZIP -z filename.zip *.* < comment.txt

For example, to "embed" this text file within the archive (while creating the archive), use this command: PKZIP -z example3.zip *.* < C:\comment.txt thus creating ZIP: EXAMPLE3.ZIP

Zip comment ?

Adding: ONE.TXT Storing ( 0%), done.

Adding: TWO.TXT Storing ( 0%), done.

Adding: ONE.EXE Deflating ( 5%), done.

Adding: TWO.EXE Deflating ( 5%), done.

Note: the above that the user will not be given a chance to enter a zip comment, as it is redirected from the text file.

Again, to display the embedded comment, simply unpack the file: PKUNZIP example3

Searching ZIP: EXAMPLE3.ZIP

*********************************

PROGRAMS & TEXT FILES

Release 14.b

MLG Solutions, Inc. - March 1997

********************************

ONE.EXE

ONE.DOC

TWO.EXE

TWO.DOC

********************************

Extracting: ONE.TXT

Extracting: TWO.TXT

Inflating: ONE.EXE

Inflating: TWO.EXE

All comments — both ZIP and individual file — are displayed using PKUNZIP with the -vt ("View Technical") switch.

For example: PKUNZIP -vt EXAMPLE1

Searching ZIP: EXAMPLE1.ZIP -

*******************************

PROGRAMS & TEXT FILES

Release 14.b

MLG Solutions, Inc. - March 1997

*******************************

ONE.EXE

ONE.DOC

TWO.EXE

TWO.DOC

******************************

Filename: ONE.TXT

File type: text

Attributes: —w-

Date and Time: Nov 19,1996 14:30:14

Compression Method: Stored

Compressed Size: 36

Uncompressed Size: 36

32-bit CRC value: 1716b870

Created by: PKZIP: 2.0 under MS-DOS

Needed to extract: PKUNZIP: 1.0

Filename: TWO.TXT

File type: text

Attributes: —w-

Date and Time: Nov 19,1996 14:30:14

Compression Method: Stored

Compressed Size: 36

Uncompressed Size: 36

32-bit CRC value: 1716b870

Created by: PKZIP: 2.0 under MS-DOS

Needed to extract: PKUNZIP: 1.0

Filename: ONE.EXE

File type: binary

Attributes: —w-

Date and Time: May 31,1994 06:22:00

Compression Method: DeflatN

Compressed Size: 10690

Uncompressed Size: 11208

32-bit CRC value: e67662e6

Created by: PKZIP: 2.0 under MS-DOS

Needed to extract: PKUNZIP: 2.0

Filename: TWO.EXE

File type: binary

Attributes: —w-

Date and Time: May 31,1994 06:22:00

Compression Method: DeflatN

Compressed Size: 10690

Uncompressed Size: 11208

32-bit CRC value: e67662e6

Created by: PKZIP: 2.0 under MS-DOS

Needed to extract: PKUNZIP: 2.0

Creating a comment for files inside a ZIP file: You can add comments to each file inside of the existing ZIP file archive, but these will not display when the file is unpacked. To add this type of comment, use the command: PKZIP -c zipfile.zip where "zipfile.zip" is the name of an existing archive file.

For example: PKZIP example1.zip -c

Updating ZIP: EXAMPLE1.ZIP

ONE.TXT

Old Comment:

New Comment? Text file on program #1

TWO.TXT

Old Comment:

New Comment? Text file on program #2

ONE.EXE

Old Comment:

New Comment? Executable file #1

TWO.EXE

Old Comment:

New Comment? Executable file #2

You will be prompted to change or enter a comment for each file within the archive. This type of comment does not display automatically during the unpacking process. These comments are only displayed using certain switches to the PKZIP/PKUNZIP command.

Note: the switch used above to add comments, -c, is case-sensitive. This switch allows creation/editing of comments for all files within the archive. Using an uppercase C in the switch allows creation/editing of comments for new files only.

To display comments embedded within the individual files, use the "view comments" switch to PKZIP: PKZIP -vc example1.zip.

For example: PKZIP -vc example1.zip

Searching ZIP: EXAMPLE1.ZIP

Length Method Size Ratio Date Time CRC-32 Attr Name

——— ——— —— —— —— —— ———— —— ——

36 Stored 36 0% 11-19-96 14:30 1716b870 —w- ONE.TXT

Comment: Text file on program #1

36 Stored 36 0% 11-19-96 14:30 1716b870 —w- TWO.TXT

Comment: Text file on program #2

11208 DeflatN 10690 5% 05-31-94 06:22 e67662e6 —w- ONE.EXE

Comment: Executable file #1

11208 DeflatN 10690 5% 05-31-94 06:22 e67662e6 —w- TWO.EXE

Comment: Executable file #2

——— ——— — ———

22488 21452 5% 4

Q. How do I shell out to DOS while using QBASIC?

A. Most applications will allow a user to go out — or shell — to DOS and return. This is not an option in QBASIC, but it can be done.

Switch to the Immediate Window — either by pressing F6 or by moving the mouse pointer to the bottom of the screen and clicking one time. Type SHELL and press the Enter key. You will be at the DOS prompt. When finished, to return to QBASIC, type EXIT and press the Enter key two times.

Another benefit of using the Immediate Window is that QBASIC saves everything typed there. Use the cursor to scroll up or down the commands and press the Enter key on the line you wish to use again. You can type entire command lines within the Immediate Window and reuse them as needed. Just put the actual command and all switches within quotations.

For example, if you wanted to shell to DOS to see the files in a directory, type in the Immediate Window: SHELL "dir c:\basic\files /w".

Something special department…

microscopy photos that range from amino acids, beer, DNA, ice cream, moon rocks, precious metals and gems, sugars, etc. But my favorites are computer-related. ChipShots offers surface features of integrated circuits and Computer Parts feature hard disks and other computer "innards". A calendar featuring computer chips is in the works. (Sample photos are on the HAL-PC BBS as PHOTOMLG.ZIP.)

Photos are courtesy of the Optical Microscopy Division of the National High Magnetic Field Laboratory, a joint venture of Florida State University, the University of Florida, and the Los Alamos National Laboratory by Michael W. Davidson. His photos have been featured on ABC's Good Morning America, CNN, CBS, the International Center for Photography, etc. at http://micro.magnet.fsu.edu/micro/gallery.html .

M. L. Giggleman is a HAL-PC member who works contract as a PC Systems Specialist/Network Administrator.


E-mail me at webmaster@hal-pc.org with any comments you have and tell me what you want to see here.

Back to the Magazine Home Page