TECHNIG
Gateway for IT Experts and Tech Geeks

How to Set Password Zip Files with Command in all OS?

Compress and protect a folder files with third party software is pretty easy for a standard user. But how do it like a command line experts? To set password Zip files with command in different operating system, might be done with various command line tools.

If you would like to learn, read this article and do it within different operating systems, like Windows, Mac OS, and Linux the command line environment. OK, let’s begin with Windows using Windows PowerShell.

Set Password Zip Files with command In Windows

In Windows using Windows PowerShell is best option, specially for new windows 10 or 8.1. If you are still with grand father of Windows 10, means XP, so try to install PowerShell on old Windows.

The compress-archive command creates a new archive, or zipped file, from specified files and folders. Unfortunately it is not support to set password zip files with command yet. Don’t blame me, it is the Microsoft masterpiece. Hope Microsoft will add the password switch to the coming update.

Let’s compress the Projects folder and it’s files. If yo are on the same directory where folder exist, and want create the compressed file to the same directory. Type “Compress-Archive Projects Projects” then hit enter.

Compress Archive Command
Compress Archive Command

To set the path and distination path for compressed folder, type the below command. For instance I compress Files folder form system directory and create it to my desktop.

 Compress-Archive -Path Files -DestinationPath C:\Users\Shais\Desktop\Files

Compress a Folder wtih Command Line in Windows
Compress a Folder with Command Line in Windows

Simply done and finished.

To set password Zip files in Windows, currently use the third party application, such as 7Zip. 7zip is a free open source tools for this purpose.

Set Password Zip Files with 7Zip
Set Password Zip Files with 7Zip

Set Password Zip Files with command In Linux

This article is on Ubuntu Linux, but works the same for all Linux operating system. The command tool is using to zip and protect a folder is Zip command.

To see the help of a command in Linux, simply type the name of command then press enter to show all options. And type “man zip” to show the manual help of zip command. The below screenshot is the options of zip command.

Zip Command In Ubuntu Linux
Zip Command Help and Options In Ubuntu Linux
  1. Open the Linux terminal and go to folder directory you want zip and protect it. I want to protect my project folder which located on my Desktop.
How to protect zip file with command in Linux
How to protect zip file with command in Linux

2. In order to zip the projects folder, type “zip -er Projects.zip Projects” hit enter and type the password twice.

Set Password Zip Files with Command in Linux to Protect it
Set Password Zip Files with Command in Linux to Protect it

OK, the Projects folder has been archived as zip file and protected with a password. The -e option enables encryption for your zip file and set the password also. The r option will add all files in Projects folder to  the zip file. The Projects.zip will be create from the Projects folder.

Compress and Protect Folder with GUI

Someone tell that the CLI is hard. So if you don’t like command line interface, then compress folders with graphical interface. Just right click the folder and select Compress.

How to Compress File in Linux
How to Compress File in Linux

On the Compress page, select .zip extension then expand Other Options and type a complex strong password. Click Create to compress the folder’s files.

Set Password Zip Files with Command
Set Password Zip Files with Command

Yes, that’s simple and easy. So don’t afraid of command line interface, it is really great, fast, and powerful interface.

Set Password Zip Files with Command in Mac OS

In a Mac OS compressing folder work the same as Linux environment So do apply it with Linux section of this article with Zip utility. If you’re familiar with the command line, the syntax of the encrypted zip command is as follows.

zip -e [archive] [file]

For encrypting multiple files and folders with a password, the syntax would be as follows.

zip -er [archive] [folder]

Finally hope it would be informative for you to learned set password zip files with command line utility in different operating system.

Leave A Reply

Your email address will not be published.