Compressed (zipped) Folder from the Command Line

D

David Payne

There is a feature in the GUI that allows us to create a ZIP file by right
clicking a file and selecting Send To Compressed (zipped) Folder.

How is this done from the command line?

This is NOT compact.exe! Compact.exe is NTFS compression. NTFS compression
is no good for transmitting data via a network.

Is there any comprehensive documentation mapping all GUI features to the
command line? Good documentation would list all GUI features even if saying,
"NO, there is no command line equivalent, " was the reality. I understand
that most software vendors do not like to document what their products do
NOT do, and only document what they can do.

This level of documentation would continue to show MS as a market leader.

Thank you for your replies...
 
T

Tim Slattery

David Payne said:
There is a feature in the GUI that allows us to create a ZIP file by right
clicking a file and selecting Send To Compressed (zipped) Folder.
How is this done from the command line?

Only by installing a zip program that can be invoked from the command
line. See PKZip's page at
http://www.pkware.com/home_and_small_office/downloads/, they certainly
have command-line ZIP tools. Also WinZip has an add-on that adds this
functionallity: http://www.winzip.com/prodpagecl.htm
 
D

David Candy

CreateBlankZip.vbs FileName.zip
==========================
Set Ag=Wscript.Arguments
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(Ag(0), 8, vbtrue)
BlankZip = "PK" & Chr(5) & Chr(6)
For x = 0 to 17
BlankZip = BlankZip & Chr(0)
Next
ts.Write BlankZip

Unzip.vbs SrcFldr DestFldr
eg, unzip "C:\..\My Documents" "C:\MyZip.zip"
It doesn't matter if the source is a zip and dest is a folder EXCEPT it only works zipping if there is a msgbox as the last statement. Dunno why. Msgbox is not needed if unzipping. I think it's an object reference thing and zipping is slow. Both Folders/Zips must exist.
===================================
Set objShell = CreateObject("Shell.Application")
Set Ag=Wscript.Arguments
set WshShell = WScript.CreateObject("WScript.Shell")

Set DestFldr=objShell.NameSpace(Ag(1))
Set SrcFldr=objShell.NameSpace(Ag(0))
Set FldrItems=SrcFldr.Items
DestFldr.CopyHere FldrItems, &H214
Msgbox "Finished"
 
K

Kelly

Great info, David.

--

All the Best,
Kelly (MS-MVP)

Troubleshooting Windows XP
http://www.kellys-korner-xp.com

In memory of those lost during Katrina &
Prayers and Hope for the remaining displaced.



"David Candy" <.> wrote in message
CreateBlankZip.vbs FileName.zip
==========================
Set Ag=Wscript.Arguments
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.OpenTextFile(Ag(0), 8, vbtrue)
BlankZip = "PK" & Chr(5) & Chr(6)
For x = 0 to 17
BlankZip = BlankZip & Chr(0)
Next
ts.Write BlankZip

Unzip.vbs SrcFldr DestFldr
eg, unzip "C:\..\My Documents" "C:\MyZip.zip"
It doesn't matter if the source is a zip and dest is a folder EXCEPT it only
works zipping if there is a msgbox as the last statement. Dunno why. Msgbox
is not needed if unzipping. I think it's an object reference thing and
zipping is slow. Both Folders/Zips must exist.
===================================
Set objShell = CreateObject("Shell.Application")
Set Ag=Wscript.Arguments
set WshShell = WScript.CreateObject("WScript.Shell")

Set DestFldr=objShell.NameSpace(Ag(1))
Set SrcFldr=objShell.NameSpace(Ag(0))
Set FldrItems=SrcFldr.Items
DestFldr.CopyHere FldrItems, &H214
Msgbox "Finished"
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top