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.
Asked
Active
Viewed 4,081 times
1
-
1You can't do it in plain vanilla batch commands. There is no zip/unzip utility. – foxidrive May 05 '14 at 15:53
-
For OS above XP 'compressed (zipped) folder' facility is available, where you right click folder and click 'send to' -> ''compressed (zipped) folder', a zip file will be created within that folder. Now select this zip file and right click, 'extract all' menu will be available. If you select this, wizard will open to extract file. I want this through Dos Prompt so that i can use it in my batch file – Arun May 06 '14 at 04:48
2 Answers
0
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

Arun
- 2,247
- 3
- 28
- 51
-
-
@foxidrive: yeah but i could not find any solution using plain windows script. I modified the question. – Arun May 06 '14 at 09:20