1

I'm trying to emulate the Windows Send to/Compressed (zipped) folder function using the Microsoft tool compress.exe, included as part of the Windows Server 2003 Resource Kit.

It might not be possible with that tool, but I'm having trouble getting it to produce anything. I have tried this scenario:

md test
cd test
md folder
echo this is file 1 >folder\file1.txt
echo this is file 2 >folder\file2.txt
md output
compress folder\*.* output -z

    Microsoft (R) File Compression Utility  Version
    Copyright (C) Microsoft Corp. 1990-1999.  All rights reserved.

    Compressing folder\file1.txt to output\folder\file1.txt using MS-ZIP compression.
    Compressing folder\file2.txt to output\folder\file2.txt using MS-ZIP compression.

dir /s

    Volume in drive C is TI80140500H
    Volume Serial Number is AC18-E911

    Directory of C:\test

    12/05/2015  01:22 a.m.    <DIR>          .
    12/05/2015  01:22 a.m.    <DIR>          ..
    12/05/2015  01:34 a.m.    <DIR>          folder
    12/05/2015  01:22 a.m.    <DIR>          output
                  0 File(s)              0 bytes

    Directory of C:\test\folder

    12/05/2015  01:34 a.m.    <DIR>          .
    12/05/2015  01:34 a.m.    <DIR>          ..
    12/05/2015  01:35 a.m.                15 file1.txt
    12/05/2015  01:36 a.m.                17 file2.txt
                  2 File(s)             32 bytes

    Directory of C:\test\output

    12/05/2015  01:22 a.m.    <DIR>          .
    12/05/2015  01:22 a.m.    <DIR>          ..
                  0 File(s)              0 bytes

        Total Files Listed:
                  2 File(s)             32 bytes
                  8 Dir(s)  558,695,092,224 bytes free

I can't see any files produced by this seemingly successful sequence. How to you coax compress to produce a zipped folder - or anything at all?

** UPDATE **

Here's the help for the tool:

Syntax:

   COMPRESS [-R] [-D] [-S] [ -Z | -ZX ] Source Destination
   COMPRESS -R [-D] [-S] [ -Z | -ZX ] Source [Destination]

Description:
   Compresses one or more files.

Parameter List:
   -R           Rename compressed files.

   -D           Update compressed files only if out of date.

   -S           Suppress copyright information.

   -ZX          LZX compression. This is default compression.

   -Z           MS-ZIP compression.

   Source       Source file specification. Wildcards may be
                used.

   Destination  Destination file | path specification.
                Destination may be a directory. If Source is
                multiple files and -r is not specified,
                Destination must be a directory.

Examples:
    COMPRESS temp.txt compressed.txt
    COMPRESS -R *.*
    COMPRESS -R *.exe *.dll compressed_dir

The first of the three examples looks like it takes a file and produces a compressed version of that file. Which it does.

The second does what you would expect, producing tempt.tx_.

The third COMPRESS -R *.exe *.dll compressed_dir does actually do something, making a lie of my previous assertions. It produces a file compressed_dir._ which I guess holds the files. COMPRESS -R *.txt *.vbs folder compressed_dir on the other hand ignores the folder AFAICT. COMPRESS -R folder compressed_dir gives an error "ERROR: The compressed_dir file is not found.".

So my conclusion is that it can't compress folders, and that it can't produce ZIP files/compressed folders.

Whatever, I have given up and used 7Zip, which works a treat.

2
  • compress.exe isn't the command-line equivalent of the Compressed (zipped) folder feature of Windows. Why do you need to use compress.exe anyway? There are a zillion ZIP utilities available, many of them free and open source.
    – Karan
    May 12, 2015 at 2:39
  • Thanks @Karan - I was under the mistaken belief that it was the command-line implementation of the Send to compressed folder function.
    – rossmcm
    May 12, 2015 at 22:59

3 Answers 3

1

I don't believe that's what the tool is intended for. Its TechNet article says you can only decompress such files using Expand.exe. Additionally, it warns not to use Compress.exe on an NTFS filesystem, and instructs using Compact.exe instead.

If you use Compact you will see that it enables compression at the filesystem level. I'm not sure which tool is related to the Send to → Compressed (zipped) Folder, but these don't seem to be them.

6
  • I don't understand why the file system has anything to do with it. I understood compress took files or folders and outputted files. I have managed to get it to produce compressed files but not from a folder. What do you suppose it actually did when it reported that it was compressing the files?
    – rossmcm
    May 11, 2015 at 23:12
  • I think it's something related to systems building, for use with images for example. The files it compressed, can you extract them or are they not standard zip files at all? You see, there seems to be another purpose for the toolset. May 11, 2015 at 23:27
  • As for the file system, I guess NTFS produces better results by enabling file system compression than Compress does. May 11, 2015 at 23:33
  • 1
    Why would it make a folder into a file? Or, why do you think that's what the tool is intended to do? I'm trying to get back to the idea that this may be the wrong tool for the job. May 12, 2015 at 0:45
  • 1
    Thanks @Louis. You are correct, it can't do what I want (see my update to the question). I misinterpreted the documentation - which is pretty terse.
    – rossmcm
    May 12, 2015 at 22:58
1

The COMPRESS and EXPAND utilities are command line tools that date back to early Microsoft products -- as in, from the MS-DOS and Windows 3.x era -- for compressing files for distribution on floppy disk.

They work with single files, where the compressed version usually has an extension with its last character changed into an underscore or dollar-sign character. (E.g., the file "vga.drv" would become "vga.dr_" or "vga.dr$" when compressed.)

This old compression format was later superseded by the Cabinet (.cab) file format, which is capable of containing multiple files. Later versions of EXPAND were able to extract files from .CABs.

That is to say, none of this has anything to do with the Compressed Files feature, nor .ZIP archives in general. This has been adequately established elsewhere in this topic, but I thought it might be helpful to add a little more historical detail on what the utility is meant to do.

0

Cabinet, Compress, Expand - are LZ77 algrithm implementation, can easly found in internet.

Expand.exe and cabinet.dll still exists in Windows, compress.exe can be found at old MS-DOS history sites like http://www.manmrk.net/tutorials/DOS/msdos.htm and runnable under DosBox also in linux you can found mscompress and msexpand - that are fully funtional analogs.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .