This line finds all Word documents in your profile:

Get-ChildItem -Path $home -Filter *.doc* -Recurse 

If you’d like, you can easily print them all. Here is how:

Get-ChildItem -Path $home -Filter *.doc* -Recurse |
  ForEach-Object {
    Start-Process -FilePath $_.FullName -Verb Print -Wait
  }

The most important part of this is the –Wait parameter: if you omit it, PowerShell would try and print all documents in parallel, launching many instances of Word at the same time. This can easily exhaust your system resources. With -Wait, PowerShell waits for Word to end a print before launching the next.

Twitter This Tip! ReTweet this Tip!

Anonymous