How to unzip a file using the cmd?
On Windows 10 build 17063 or later you can use tar.exe
(similar to the *nix one). This is also available in the nanoserver docker container
C:\> tar -xf archive.zip
If you have Windows 10, you can use the much shorter Powershell equivalent
Expand-Archive -Force C:\path\to\archive.zip C:\where\to\extract\to
This batch file code will help you to unzip a file.
@echo off
setlocal
cd /d %~dp0
Call :UnZipFile "C:\Temp\" "c:\FolderName\batch.zip"
exit /b
:UnZipFile <ExtractTo> <newzipfile>
set vbs="%temp%\_.vbs"
if exist %vbs% del /f /q %vbs%
>%vbs% echo Set fso = CreateObject("Scripting.FileSystemObject")
>>%vbs% echo If NOT fso.FolderExists(%1) Then
>>%vbs% echo fso.CreateFolder(%1)
>>%vbs% echo End If
>>%vbs% echo set objShell = CreateObject("Shell.Application")
>>%vbs% echo set FilesInZip=objShell.NameSpace(%2).items
>>%vbs% echo objShell.NameSpace(%1).CopyHere(FilesInZip)
>>%vbs% echo Set fso = Nothing
>>%vbs% echo Set objShell = Nothing
cscript //nologo %vbs%
if exist %vbs% del /f /q %vbs%
N.B. C:\Temp is folder where it stores the Extracted (UnZip) File.
And, c:\FolderName\batch.zip is source path, (where Zip files are stored).
Please, Change the Full File Path ( Drive, Folder & Zip file name), according to your need.