Using XCOPY to use zip up a folder using Windows intergrated zip?

Soldato
Joined
4 Aug 2004
Posts
2,734
Location
on OCUK
Hey all,

As title am just wondering if there is any way to use XCOPY to compress a folder so its output is a .zip..I know this can be done using winrar, etc but ideally want to use the windows intergrated zip..

Is this possible? I cant seem to find the exe for the zip..

(edit found this to be compact.exe but the output is not a .zip

Any help will be appreciated..:)
 
Last edited:
In a word no.
the windows zip is actually a DLL :%SystemRoot%\system32\zipfldr.dll,-10226
Unfortunatly I don't think you can call it with rundll32 as I don't know what the parameters are.

If VB.net is an option try this code:
Code:
Private Sub zipFile(ByVal filename As String, ByVal zipfilename As String)
        Dim strZIPHeader As String

        strZIPHeader = Chr(80) & Chr(75) & Chr(5) & Chr(6) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0) & Chr(0)
        Dim fso = CreateObject("Scripting.FileSystemObject")
        Dim tf = fso.CreateTextFile(zipfilename)
        tf.Write(strZIPHeader)
        tf.Close()

        With CreateObject("Shell.Application")
            .NameSpace(zipfilename.ToString).CopyHere(filename.ToString)
        End With
        MessageBox.Show("All done!")
    End Sub

(not mine, from http://social.msdn.microsoft.com/Fo.../thread/d3e347cc-f4dc-44a6-8f84-977f958d89c6/)
 
Back
Top Bottom