Native unzip on Windows

I want unzip files from my app. On the Mac/Linux size, I can count on the proper tools being available through the shell, but not in Windows, and I don’t want to install anything additional on the user’s system.

I found this which uses (I think) a VBScript to do the job. Before I go down the rabbit hole of testing, does anyone think this will not work on XP or higher?

Is there a better way to do it that doesn’t involve distributing an external app or installing a third-party class or plugin?

(I know and use @Thomas Tempelmann 's excellent zip class, but can’t for this project.)

[quote=150871:@Kem Tekinay]I want unzip files from my app. On the Mac/Linux size, I can count on the proper tools being available through the shell, but not in Windows, and I don’t want to install anything additional on the user’s system.

I found this which uses (I think) a VBScript to do the job. Before I go down the rabbit hole of testing, does anyone think this will not work on XP or higher?

Is there a better way to do it that doesn’t involve distributing an external app or installing a third-party class or plugin?

(I know and use @Thomas Tempelmann 's excellent zip class, but can’t for this project.)[/quote]

See Compress to zip
http://technet.microsoft.com/en-us/library/hh206107.aspx
and Expand to unzip
http://technet.microsoft.com/en-us/library/cc722332(v=WS.10).aspx

Are you sure about those? Your first link (compress) routes to a System Center thing (huh?). Your second link goes to Expand command line, but that’s not a .zip thing - it supports .cab files.

Sorry. Here is a video
http://windows.microsoft.com/en-us/windows/compress-uncompress-files-zip-files#1TC=windows-7

I thought expand would work as well, but I just tested it on the command line and it didn’t handle a standard zip file correctly.

It should. What happened ?

@Michel Bujardet I expanded a zip file called mc.zip using expand mc.zip myzipfolder. Myzipfolder folder then contained a copy of mc.zip, not the expanded files. Listing the contents via expand only listed mc.zip.

The file did expand correctly from the GUI, unzipping mc.exe and mc.ini.

[quote=150943:@Tanner Lee]@Michel Bujardet I expanded a zip file called mc.zip using expand mc.zip myzipfolder. Myzipfolder folder then contained a copy of mc.zip, not the expanded files. Listing the contents via expand only listed mc.zip.

The file did expand correctly from the GUI, unzipping mc.exe and mc.ini.[/quote]

Strange. The GUI should use the same program, but with Windows one never quite knows.

How was the file created ? Zip is not quite homogenous. Some zipping apps use strange compression formats that are not necessarily compatible with the default system utilities.

Can you pack a helper executable with your app? http://downloads.sourceforge.net/sevenzip/7za920.zip

Can you say more? Is the issue legal / licensing? DLL hell? Technical?

The “Compressed (zipped) Folders” were introduced with “Windows xp”.

For VBA code, see Internet search results with string “how to use windows compressed folder in VBA”, for example, among others.

Sure.

I’m working on a cross-platform, Xojo-based self-updater. I’ve got it working on Mac and Linux using native tools only and want to do the same for Windows. I want to minimize the number of steps a developer has to take to get it running, so I would prefer that those developing for Windows not have to include a copy script to include the app into their applications.

Right now, after copying the classes into your project, you have to add a single property to App. In code, you create a new UpdateChecker object, fill in a few properties, and tell it to Execute. (There is an accompanying admin app to let you set up the files you need on the server side.) That’s it.

I could distribute another tool that has to be included in the project too, but if I can do it natively, that would be better.

Since this will be open-source, any commercial classes, plugins, or apps are out of the question.

[quote=151007:@Kem Tekinay]Sure.

I’m working on a cross-platform, Xojo-based self-updater. I’ve got it working on Mac and Linux using native tools only and want to do the same for Windows. I want to minimize the number of steps a developer has to take to get it running, so I would prefer that those developing for Windows not have to include a copy script to include the app into their applications.

Right now, after copying the classes into your project, you have to add a single property to App. In code, you create a new UpdateChecker object, fill in a few properties, and tell it to Execute. (There is an accompanying admin app to let you set up the files you need on the server side.) That’s it.

I could distribute another tool that has to be included in the project too, but if I can do it natively, that would be better.

Since this will be open-source, any commercial classes, plugins, or apps are out of the question.[/quote]

Expand works fine, as long as you stick to a simple zip method, or compress it with Windows.

Including the 7z.exe command line with your app guarantees the use from XP and beyond. Depending on the use you must to rise privileges to admin rights (reading zips or writing files inside privileged folders for instance). Trying to run VBScripts (needs CSCRIPT.exe) or Expand.exe found in alien systems can obtain diverse results and headaches. I would include my own solution in my package.

Kem, Zip is both a file format (containing a list of files) as well as a compression method. I believe one can have a valid zip format enclosure, where the actual files inside are not compressed at all. You don’t get the benefits of compression, but you don’t have to deal with the speed hit from decompression either. Could you do something like that?

Pretty sure that zlib is open source friendly.

Check out the libraries at great white software

http://www.great-white-software.com/gws-rb-samples/GZip_RB.zip

If I have to include something more in the project, I will, but I don’t want to turn off developers either. I like that’s it’s mostly turnkey right now.

I’ll try expand and go from there, thanks.

you will likely have to use a third party utility. “Expand” only decompresses .cab files. It copies other types of archives to the destination folder.

I also like 7zip. A nice tool that understands pretty much all common compression formats.

I haven’t tested, but what’s the downside of the script I posted at the top of this thread? Might it not work on all systems?

you need elevated privileges to run vbscripts on many computers, depending on policies that are not always under the control of the user (i.e. group policies). That method may simply fail on such computers. You would know whether this is a real issue with your target group.