سؤال

By default, all the zipped files in Windows 8/8.1 are configured to open with the File Explorer program that the operating system has. I want to unzip all files in a certain directory and preserve the folder names when unzipped using batch script. I know how to do this when 7-Zip installed on the machine. But how to do this on Windows 8/8.1 when no extracted software installed? I want to do this using windows script.

هل كانت مفيدة؟

المحلول

I found the way to do it using vbscript. Here is the code.

strZipFile = ""                                       'name of zip file
outFolder = ""                                       'destination folder of unzipped files

Set objShell = CreateObject( "Shell.Application" )
Set objSource = objShell.NameSpace(strZipFile).Items()
Set objTarget = objShell.NameSpace(outFolder)
intOptions = 256
objTarget.CopyHere objSource, intOptions

Fill in the appropriate names for the zip file and the output folder (must be quoted). Save the script with a vbs extension. In the batch file we can run the script with this entry: cscript //nologo scriptname.vbs

نصائح أخرى

You can check the zipjs.com utility introduced here

// unzips only part of the zip with given path inside
zipjs.bat unZipItem -source C:\myDir\myZip.zip\InzipDir\InzipFile -destination C:\OtherDir -keep no -force yes
zipjs.bat unZipItem -source C:\myDir\myZip.zip\InzipDir -destination C:\OtherDir
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top