This project is read-only.

Set comment while compression.

Sep 18, 2010 at 10:29 AM
Edited Sep 18, 2010 at 10:31 AM

Hi Markhor

How can i set comment to file while compressing? i know that you are not going work for free. but can you give me hint?

In ArchiveUpdateCallback.cs there is function GetProperty(), but its not going to call


case ItemPropId.Comment:
value.VarType = VarEnum.VT_BSTR;
value.Value = Marshal.StringToBSTR("Comment");


in the switch case.

Please provide direction,how should i proceed?

Thanks and regards,


Sep 28, 2010 at 8:24 AM


I am not sure if I am right, but you may try to create an archive and then update it (something like ArchiveMode.Update). And when an archive is updated, the properties can be changed.


I will be able to look into this in detail in a week.

Sep 28, 2010 at 8:40 AM

hello markhor,

Thanks for reply...i want to set index properties while compressing...

In the ArchiveUpdateCallback.cs file there is function called GetProperty

In the switch case you have set values for below properties

case ItemPropId.IsAnti:

case ItemPropId.Path:

case ItemPropId.IsDirectory:

case ItemPropId.Size:

case ItemPropId.Attributes:

case ItemPropId.CreationTime:

case ItemPropId.LastAccessTime:

case ItemPropId.LastWriteTime:

case ItemPropId.Extension:

My simple question is in that switch case can we add case ItemPropId.Comment: 

In our current project we required to set comment for every index.

Waiting for your kind help.

Thanks in advanced,


Oct 1, 2010 at 8:58 PM


The answer on your question is NO, unfortunately. All switch cases correspond to the specific callback calls, and 7-Zip core never asks for the comment. I will investigate how to add comments to separate files during the next week. It is surely possible, but at the moment I don't have the solution.

Oct 2, 2010 at 5:39 AM

Hello markhor,

Thanks for your answer,ok then we will find out alternative solution in our project to fixed this issue.

Anyways you have done gr8 job providing us C# wrapper for 7z software. keep it up.

Thanks and Regards,


Mar 19, 2012 at 2:57 PM

I have the need to add comments to an existing rar file and new rar file. Have you figured out how to set comments yet?