PowerShell is cool – how many images in a Word document.


Problem: How many screen captures do I have in my new book? (Just curious you know…)

The Answer… PowerShell!

A quick Bing and I found this:



As I only need to check one file, I shortened the code to just this:



So now I know… I’ve created over 300 screen captures for the new SharePoint® 2007 and 2010 Customization for the Site Owner book.



1 comment:

Mike Smith said...

$file = "" #full path

function WordStats ($file)
$word = New-Object -ComObject word.application
$word.Visible = $false
$doc = $word.Documents.Open($file)

"InlineShapes: " + $doc.InlineShapes.Count
"Paragraphs: " + $doc.Paragraphs.Count
"Words: " + $doc.Words.count
"Characters: " + $doc.Characters.Count


Note to spammers!

Spammers, don't waste your time... all posts are moderated. If your comment includes unrelated links, is advertising, or just pure spam, it will never be seen.