printing from command line

A

A Inzerillo

Is there a way to open a document, print it, and exit Word
from the command line? Or maybe there is another way, VB
perhaps, that I can print a number of Word documents
without opening up word manually.
 
S

Si-Qing Chen [MSFT]

The following vbscript will print a word document from
the command line.

-----------------
Dim WordApp, Doc
Set WordApp = CreateObject("Word.Application")
Set Doc = WordApp.documents.open("c:\test.doc")
Doc.PrintOut
WordApp.Quit
------------------

If the above script is named "printdoc.vbs", the
commandline will be:

cscript printdoc.vbs


This posting is provided "AS IS" with no warranties, and
confers no rights.

Si-Qing
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top