2

I'm seeing some weird behavior with 7z. I create an archive with the following command:

7za.exe a "zip_test.zip" -r "C:\zip_test\*" -p"abc123"

When I open the archive zip_test.zip using the 7z GUI and attempt to extract a file I'm asked for a password as expected, but when I run the following command on the same archive all the files and directories at the top level are extracted without me having provided a password, and I'm only prompted for a password once 7z starts processing deeper levels (i.e. not the top level), after the top level files have already been extracted:

7za.exe x -y -o"C:\zip_test" "C:\zip_test.zip"

I know the zip format has limitations when it comes to password protection, but I would expect 7z GUI and 7z command line to behave the same on the same archive. I do not see this behavior when using the 7z format.

Some clarification of what is going on here would be appreciated.

  • Anecdotally, doing a bit of experimenting on Windows 7, 7za.exe (7zip 9.20 command line) apparently behaves slightly differently than 7z.exe (7zip 19.00) in terms of the files/placeholders (with 7za.exe, not all the placeholders(?) are apparently always 0B when the wrong password is entered). Even so, and even using 7za.exe, with the wrong password, none of the "extracted" non-0B files seem usable. I think the (partial) solution here is to upgrade 7zip (though you still not may have "no files" as with the GUI). – Anaksunaman Dec 11 '19 at 0:56
1

I can't reproduce the problem, and there might be some detail you have missed.

The files are not extracted, and only zero-size place-holders files are created, waiting for the password to be entered.

If the password is not entered, or an erroneous password is used, the files will stay as zero-size.

Sub-folders cannot be password protected, so are created without the need for the password.

| improve this answer | |
  • The missing detail was that the file unzipped by 7z command line was zero sized and had no content. I didn't open the file originally to see that it had no content. 7z command line and 7z GUI just don't behave the same in this manner which was confusing me. Thanks! – ubiquibacon Dec 11 '19 at 16:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.