
罗汉塔最少步骤

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/
罗汉塔最少步骤