Page 1 of 1
Batch unzip
Posted: 22 Feb 2010 13:57
by d_a_r_k
Hello, I want to make a batch file which reads computer for specified archive name and when he does find it - extract contents of the archive to directory from where the batch file has been executed.
The archive is in .7z format for this to work we will need 7-Zip Command Line version
http://sourceforge.net/projects/sev...
If someone knows how to use it, could you please help me with this?
Thanks in advance

Re: Batch unzip
Posted: 22 Feb 2010 16:35
by !k
d_a_r_k wrote:directory from where the batch file has been executed
Current dir? Use %cd% var:
Re: Batch unzip
Posted: 22 Feb 2010 17:04
by d_a_r_k
I get an error "cannot find archive"
Re: Batch unzip
Posted: 22 Feb 2010 17:10
by d_a_r_k
Maybe it is possible to make batch file find this specific archive location and put the destination path to 7-Zip command line for extraction?
Re: Batch unzip
Posted: 22 Feb 2010 18:21
by !k
Quite so.
Code: Select all
7z e "d:\full path\archive.zip" -o"%cd%" *.* -r
Re: Batch unzip
Posted: 22 Feb 2010 23:26
by d_a_r_k
Unfortunately I still get the same error, it cannot find the specified archive.
Re: Batch unzip
Posted: 23 Feb 2010 03:06
by !k
Try to use the full path to 7z.exe

Re: Batch unzip
Posted: 23 Feb 2010 10:12
by d_a_r_k
This method does not work either

Re: Batch unzip
Posted: 06 Mar 2010 18:13
by SuzyQJax
Do you have 7z.exe in the System32 directory?
Re: Batch unzip
Posted: 06 Mar 2010 21:15
by SuzyQJax
7z Command Description:
a Add - create a new archive, or add files to an existing archive
d Delete - remove files from an existing archive
e Extract - unarchive files
l List - display the contents of an archive
t Test - validate the integrity of an archive
u Update - overwrite existing files in an existing archive
x Extract - same as āeā, except that the files are restored to their exact original locations (if possible)
I just ran the test code and it extracted to desktop just fine.
Code: Select all
@Echo Off
:: Extracting then Expand Test.7z file from C:\Zip directory to desktop without prompt
7z.exe e "C:\Zip\test.7z"
exit