I have a directory with subdirectories and I want to extract every zip file. Some of the subdirectories and zip files have brackets, pipelines and much more in the name. I don't want to directly extract the zip, it has to be extracted to a folder with the same name as the zip and then the zip must be deleted and then it finds another zip and keeps going until there are no more remaining zip files to extract.
To my knowledge, there is no pre-installed command line utility on Windows for extracting zip files, so using a batch script is a no-go. If you were on a Unix system, I would recommend you run "man unzip" and learn the basics of Bash. Since you're not, you should be using PowerShell.
PowerShell, unlike Bash and Batch, is not limited to calling external programs, and in fact, has access to the entirety of the .NET standard library. This includes the System.IO.Compression.ZipFile class, which you can use for your unzipping needs. See here for an example of its use:
It should be noted, however, that the class was added in .NET Framework 4.5, so make sure you are using at least PowerShell version 4, or you are using PowerShell Core
Nicholas Diaz
Windows has a binary called FORFILES That's your first step, it's just an iterator
Carter Ross
Windows 10 has bash now, doesn't it? Why are you punishing yourself?
Ryan Baker
>To my knowledge, there is no pre-installed command line utility on Windows for extracting zip files, so using a batch script is a no-go.
There are literally thousands of command line programs that will uncompress a .zip archive file. Personally, I still use the PKZIP 2.50 program.
Today, though, I would recommend the command line version of 7-zip for windows. You have to download the "Extras" package for 7-zip to get the command line 7-zip executable.
Austin Nelson
Yes, but are any of those utilities pre-installed? You could easily just get the Unix unzip utility and install it on Windows. If OP wants a pure PowerShell or pure batch solution, however, I will not assume they have access to any arbitrary computer program.
Brandon Green
Jow Forums isn't preinstalled on your computer, either. Yet, here you are.
>Yes, but are any of those utilities pre-installed?
What difference does that make? The zip/unzip programs are not part of any unix/linux kernel or unix/linux shell either.
Being pre-installed in your distribution doesn't make it any better/worse than any other program. There are distributions that do not have zip/unzip pre-installed.
Both powershell and the windows cli can run windows cli programs.
As far as I know, we're only talking about one function, a cli program that can uncompress a .zip archive, here.