RTF Files

Converting RTF to TXT via PowerShell

So I ran into a problem recently where I needed to convert an RTF document back to it’s base text values.  I could do it via a copy & paste, but after digging around a little bit, I happened on an article from Microsoft with some pointers.  How to: Convert RTF to Plain Text (C# Programming Guide)

Now, I have no problems with C# or anything that requires compilation, but I like PowerShell.  So I took what Microsoft gave me and wrote a small function to do the work for me.  Right now it only handles a path to the RTF file for conversion, but can probably be easily extended to allow for other permutations.

Enough talk!  Code, monkey, code!!!

 

3 thoughts on “Converting RTF to TXT via PowerShell

  1. Thank you. This helped me to automate the parsing of rtf files exported from an Outlook OST with libpff. I used this method in a function I just wrote. “https://github.com/oregon-national-guard/powershell/blob/master/ConvertFrom-Rtf.ps1” Cheers

  2. Hey Kevin, I am a complete newbie to powershell and have discovered my need for it with a project that requires doing just this. Would you mind please telling me how to actually make use of your code.?Thank you so much!

  3. Jeremy – here’s a quick code snippet that I’m providing:

Leave a Comment