I found the above listed:
for /r %a in (*.zip) do 7z.exe e "%~a" -o"%~dpa"
to expand everything into the current directory. Not exactly what I was looking for anyways.
So, assuming I am in a working directory which contains a number .zip files and each of those zip files contain additional zip files etc then the following will expand them all retaining the the paths:
for /r %A in ("*.zip") do 7z.exe x "%~dfA" -o"%~pnA"
To explain this there are two parts,
- search for files based on criteria
- for each file found do something
First part, search
for /r %A ("*.zip")
search for files matching ("*.zip") and for each file found replace the variable %A with the filename then pass it to the second part
...I skipped over /r which is the recurse flag
second part, do something (so for each file found do...)
do 7z.exe x "%~dfA" -o"%~pnA"
do 7z.exe x - do 7zip extract
then two arguments for 7z
"%~dfA" : "%-df" bit gets the drive letter and fully qualified path for whatever follows it, in this case A follows it, which is a reference to our earlier declared A and is the file being passed to the do
-o"%~pnA" : -o is the 7zip output flag
"%~pn extracts the path and filename (w/o ext) from whatever follows it, again it's A
example
given file: c:\test\foo.zip being passed to: -o"%~pnA"
"%-p" would extract the path from the file, *c:\test*
"n" would extract the simple filename, foo
resulting in c:\test\foo
Reference
https://learn.microsoft.com/en-us/windows-server/administration/windows-commands/for
dir -Recurse -file -filter *.zip | %{Expand-Archive $_.FullName $_.PSParentPath}
for /R %x in (*.CBZ) do ren "%x" *.ZIP
first