S
S
sbh2015-06-09 10:16:14
cmd/bat
sbh, 2015-06-09 10:16:14

How to delete file properties with a script (bat, vbs)?

How to remove file properties with a script?
Properties are understood as all information on the "Details" tab (if you open the file's properties).

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
omegastripes, 2015-06-11
@sbh

For example, to remove properties and personal information from Excel files, you can save the code below as a .vbs file, and to remove properties, simply drag and drop the desired Excel files onto the script file.

Option Explicit
Dim sSrc, oWB, oProp
With CreateObject("Excel.Application")
  .Visible = False
  .DisplayAlerts = False
  For Each sSrc in WScript.Arguments
    On Error Resume Next
    Set oWB = .Workbooks.Open(sSrc)
    On Error Goto 0
    If .Workbooks.Count > 0 Then
      For Each oProp In oWB.BuiltinDocumentProperties
        oProp.Value = Empty
      Next
      .UserName = " "
      oWB.Save
      oWB.Close
    End If
  Next
  .Quit
End With
CreateObject("WScript.Shell").PopUp "Completed", 1, , 64

S
sbh, 2015-10-28
@sbh

But what about other types of documents? for example for Word?

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question