Quantcast
Channel: The Official Scripting Guys Forum! forum
Viewing all articles
Browse latest Browse all 15028

Extracting text from many .doc* files in a directory with Powershell?

$
0
0

Hi! 

This seems to be the best way to extract text from Word files from what I've read in other forums: 

//

$wd = New-Object -com word.Application

$doc= $wd.Documents.Open("c:\file.doc")

$doc.Range().text

$doc.Range().paragraphs | foreach {$_.range.text}

//

But instead of extracting the text from one document, how do I iterate through all the Word documents in a directory, extract the text, and then combine the text from the multiple files into a new .txt/.csv file in a different directory? I am new to scripting, so my apologies if this is naive! 


Viewing all articles
Browse latest Browse all 15028

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>