How to create a zip file with password?

Richard Yao

New Member
I know this needs to be realized through C# codes. I used below ZipFile to create ZIP file. But it does not allow password property. So any idea how to set password for the ZIP file?

try
{

ZipFile.CreateFromDirectory(InputDirectory, ZipFileName);
success = true;
message = String.Empty;
}
catch (Exception e)
{
success = false;
message=e.ToString();
}
 

sahil_raina_91

Active Member
As far as I am aware, you wont be able to do it natively via .Net code.

You will either need to write a separate PowerShell script or utilize some other tool.
We have 7zip installed on our VM's and use that to password protect a zip file via Command Line (Start Process action in Blue prism)
 
Top