Saturday, November 23, 2019

PowerShell one-liner to start a blank Microsoft Word document

With help from this post, I experimented in PowerShell and get this successful result on my PC

$Word=NEW-Object -comobject Word.Application ; $Word.visible=$true ; $Word.documents.Add()

As long as I don't close PowerShell window, to create a second blank document, all I have to type is this line:

$Word.documents.Add()


No comments:

Post a Comment