0

I have coded a batch file to unzip a file as follows:

unzip images.zip

exit

But its not working. Its for creating exe file using IExpress.

What is the code to unzip a file?

Hayt
  • 5,210
  • 30
  • 37
Anitha
  • 43
  • 1
  • 1
  • 8
  • How did you zip the file? – DavidPostill Sep 02 '16 at 11:15
  • 3
    Do you actually have a program named unzip installed on your computer because Windows does not have a native console application to zip and unzip. – Squashman Sep 02 '16 at 12:29
  • take a look [here](http://stackoverflow.com/questions/28043589/how-can-i-compress-zip-and-uncompress-unzip-files-and-folders-with-bat) and the second option – npocmaka Sep 02 '16 at 13:19

3 Answers3

4

The other answers require additional software to be installed. Here is a solution using PowerShell (included in Windows 7 and upwards):

powershell.exe -nologo -noprofile -command "& { $shell = New-Object -COM Shell.Application; $target = $shell.NameSpace('C:\extractToThisDirectory'); $zip = $shell.NameSpace('C:\extractThis.zip'); $target.CopyHere($zip.Items(), 16); }"

This uses the built-in extract functionality of the Explorer and will also show the typical extract progress window. The second parameter 16 to CopyHere is a "yes to all" for possible questions while extraction.

A Person
  • 1,062
  • 9
  • 17
3

the following utility can do what you want

https://mega.nz/#!VMISDCaD!gEFVVWYN5ODwbtJm4aXNjQW3uVqcUyhqb-DOf0aOmH0

the script to use these .exe files

to zip compress a single file

zip.exe "C:/path/to/file.extenxion" "zipfilename"

to zip compress all files in a folder

zip.exe "C:/path/to/files/*.*" "zipfilename"

or if you want to unzip

unzip.exe zipfilename

note that you dont need to add the .zip extension to make it work

3

This is an example of unziping images.zip with winrar and copying it to Output on the desktop in batch

@ECHO ON
"C:\Program Files (x86)\Winrar\WinRAR.exe" x "%userprofile%\Desktop\images.zip" *.* "%userprofile%\Desktop\Output\"
pause
Jonas
  • 1,105
  • 1
  • 15
  • 21