The following Windows script demonstrates how to get the document Title. You'll want to create a file that ends with ".wsf" and paste this into it. Obvoiusly, you'll iterate over your files and rename them as you go. That's the easy part. This is the "hard" part and shown only how to get the Title.
I have CScript set as my default script engine. If you don't, you can run your script from the command line by:
You can make CScript the default engine by:
Once you've done that, your script will run merely by typing its name:
You'll need DSOFile from Microsoft.
<?job error="true" debug="false" ?>
' Start of main program
filename = "testfile.doc"
title = getTitle( filename )
' Needs DSOFile from http://www.microsoft.com/en-us/download/details.aspx?id=8422
Function getTitle( filename )
Set objFile = CreateObject("DSOFile.OleDocumentProperties")
objFile.Open( filename )
getTitle = TrimEx(objFile.SummaryProperties.Title)
Set re = New RegExp
re.Pattern = "^\s*"
re.Multiline = False
retval = re.Replace(str, "")
re.Pattern = "\s*$"
TrimEx = re.Replace(retval, "")