Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have a source zip file which is located in a user's "My Documents" directory. It is guaranteed to always be there. I'm looking for a way to create a batch or script which will let me unzip that file to a destination directory also within the user's directory. If the destination is already there, it should first delete the existing destination folder.

Example process:

srcFile = %user%\My Documents\
destFolder = %user%\My Documents\Unzipped\
if destFolder exists, delete it
unzip srcFile to destFolder

I'm looking for a solution that will work on Windows XP and Windows 7. If possible, I don't want to use a zip application other than the one built into Windows XP/7.

share|improve this question
We're not here as a script writing service. ;) So, what have you got so far, and where are you getting stuck? – Ƭᴇcʜιᴇ007 May 28 '13 at 18:50
Your last sentence is problematic. Not only does the Compressed Folders function suck, it's not possible to access from the command line AFAIK. You'll probably have to invoke a VBS script from your batch file. If you use a 3rd party command line unzipper what you want to do is really trivial. – Karan May 28 '13 at 19:10
up vote 2 down vote accepted


RD /S /Q "%USERPROFILE%\My Documents\Unzipped"
cscript UnzipZip.vbs


strZipFile  = "\"
strUnzipped = "\Unzipped\"

Sub UnZip(ExtractTo,ZipFile)

Set fso = CreateObject("Scripting.FileSystemObject") 
    If NOT fso.FolderExists(ExtractTo) Then 
End If 

Set objShell = CreateObject("Shell.Application") 
Set FilesInZip=objShell.NameSpace(ZipFile).items 

Set fso = Nothing 
Set objShell = Nothing 
End Sub

set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("MyDocuments")

strZipPath   = strDesktop & strZipFile
strUnzipPath = strDesktop & strUnzipped

UnZip strUnzipPath , strZipPath
share|improve this answer
I get an error on the last line: "Cannot use parentheses when calling a Sub". Any thoughts on what to fix? – Michael Mankus May 29 '13 at 11:15
@MichaelMankus Sorry, fixed. – STTR May 29 '13 at 17:11

Here I've tried to summarize ways of how can files and folder be zipped without external tools:

And also tried to create a tool for common usage capable of zipping unzipping and few more features. ZIPJS.BAT - it does not need additional files like .vbs nor creates a temp ones.All in one and called like a normal bat file.

to unzip folder of file you can use this:

// unzip content of a zip to given folder.content of the zip will be preserved (-keep yes).Destination will be overwritten (-force yes)
call zipjs.bat unzip -source C:\myDir\ -destination C:\MyDir -keep yes -force yes
share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.