When you right click on a file in Windows Explorer and click properties and then click the Custom tab there is a list of properties. I want to add one of these custom properties using a VBScript file. The property's name must be Version and the value must be a version number such as 1.0.0.0. The file type is an msi.
A:
To read and write custom file properties, you need to use the DSOFile.OleDocumentProperties
COM object that is provided by the dsofile.dll library.
Here's sample code to accomplish your task:
Set oFile = CreateObject("DSOFile.OleDocumentProperties")
oFile.Open("E:\Setup.msi")
oFile.CustomProperties.Add "Version", "1.0.0.0"
oFile.Save
oFile.Close
Before running this code, make sure you have registered dsofile.dll in the system:
regsvr32 dsofile.dll
More info on using the dsofile.dll in this TechNet article.
Helen
2010-09-24 13:14:41