Решение подсказали тут: Решение на VBS
[vba]Код
Option Explicit
Dim strDestFile
Dim objSourceFolder
Dim strSourceFolder
Dim objFSO
Dim objFile
Dim objTS
Dim objWord
strDestFile = "out.csv"
Set objSourceFolder = WScript.CreateObject("Shell.Application").BrowseForFolder(0, "Select source folder:", 81, "")
If Not objSourceFolder Is Nothing Then
strSourceFolder = objSourceFolder.self.Path
Set objFSO = WScript.CreateObject("Scripting.FileSystemObject")
If objFSO.FolderExists(strSourceFolder) Then
Set objWord = Nothing
Set objTS = objFSO.CreateTextFile(objFSO.BuildPath(strSourceFolder, strDestFile), True)
objTS.WriteLine "Имя файла;Количество примечаний"
For Each objFile In objFSO.GetFolder(strSourceFolder).Files
Select Case LCase(objFSO.GetExtensionName(objFile.Name))
Case "doc", "docx"
If objWord Is Nothing Then
Set objWord = WScript.CreateObject("Word.Application")
End If
With objWord.Documents.Open(objFile.Path)
objTS.WriteLine objFile.Name & ";" & .Comments.Count
.Close
End With
Case Else
' Nothing to do
End Select
Next
objTS.Close
Set objTS = Nothing
If Not objWord Is Nothing Then
objWord.Quit
Set objWord = Nothing
End If
Else
WScript.Echo "Can't use folder [" & strSourceFolder & "]."
WScript.Quit 1
End If
Else
WScript.Echo "Cancelled choice folder."
End If
WScript.Quit 0
[/vba]