
羅漢塔最少步驟

If you have a large batch of files to compress and you want to add password protection to each of them, what is the simplest or quickest way to do so? Today’s SuperUser Q&A post has the answer to a curious reader’s question.
如果要壓縮大量文件,并且要為每個文件添加密碼保護,最簡單或最快的方法是什么? 今天的“超級用戶問答”帖子回答了一個好奇的讀者的問題。
Today’s Question & Answer session comes to us courtesy of SuperUser—a subdivision of Stack Exchange, a community-driven grouping of Q&A web sites.
今天的“問答”環節由SuperUser提供,它是Stack Exchange的一個分支,該社區是由社區驅動的Q&A網站分組。
問題 (The Question)
SuperUser reader DAE wants to know how to zip and password protect files in as few steps as possible:
SuperUser閱讀器DAE希望知道如何以最少的步驟壓縮和保護文件:
I need a way to take a bunch of files and compress them into separate zip files with each using the same password. I want to be able to do this in one simple step. I have created a batch file that zips each of them using 7zip (which worked perfectly), but does not password protect them.
我需要一種方法來提取一堆文件并將它們壓縮為單獨的zip文件,每個文件都使用相同的密碼。 我希望能夠通過一個簡單的步驟來完成此操作。 我創建了一個批處理文件,該文件使用7zip(非常有效)對每個文件進行了壓縮,但沒有密碼保護它們。
Is there a command that I can add to the batch file that includes the password? Or alternatively, how can I create a batch file that will password protect the compressed files?
是否可以添加到包含密碼的批處理文件中? 或者,如何創建批處理文件以密碼保護壓縮文件?
How do you zip and password protect files in as few steps as possible?
如何以最少的步驟壓縮和密碼保護文件?
答案 (The Answer)
SuperUser contributor DavidPostill has the answer for us:
超級用戶貢獻者DavidPostill為我們提供了答案:
How can I create a batch file that will password protect the compressed files?
如何創建批處理文件,用密碼保護壓縮文件?
Use the -p option, -p (set password) switch, which specifies the password.
使用-p選項,-p(設置密碼)開關,它指定密碼。
Syntax
句法
- -p{password}-p {密碼}
{password} specifies the password
{password}指定密碼
Examples
例子
Compresses *.txt files to archive.7z using the password “secret”. It also encrypts archive headers (-mhe switch) so that the file names will be encrypted.
使用密碼“ secret”將* .txt文件壓縮為archive.7z。 它還會加密存檔頭(-mhe開關),以便對文件名進行加密。
- 7z a archive.7z -psecret -mhe *.txt 7z存檔7z -psecret -mhe * .txt
If compressing folders:
如果壓縮文件夾:
- “C:\Program Files (x86)\7-Zip\7z.exe” a “%%X.zip” -psecret “%%X\” “ C:\ Program Files(x86)\ 7-Zip \ 7z.exe”“ %% X.zip” -psecret“ %% X \”
Extracts all files from archive.zip using the password “secret”.
使用密碼“ secret”從archive.zip中提取所有文件。
- 7z x archive.zip -psecret 7z x archive.zip -psecret
Source: -p (set Password) switch
來源:-p(設置密碼)開關
Have something to add to the explanation? Sound off in the comments. Want to read more answers from other tech-savvy Stack Exchange users? Check out the full discussion thread here.
有什么補充說明嗎? 在評論中聽起來不錯。 是否想從其他精通Stack Exchange的用戶那里獲得更多答案? 在此處查看完整的討論線程。
翻譯自: https://www.howtogeek.com/300790/how-do-you-zip-and-password-protect-files-in-as-few-steps-as-possible/
羅漢塔最少步驟