Anitha
Anitha

Reputation: 43

How to unzip a file using batch?

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?

Upvotes: 0

Views: 18705

Answers (3)

A Person
A Person

Reputation: 1112

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.

Upvotes: 5

Jonas
Jonas

Reputation: 1195

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

Upvotes: 3

NickyGamePlays
NickyGamePlays

Reputation: 79

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

Upvotes: 3

Related Questions