• Welcome to Overclockers Forums! Join us to reply in threads, receive reduced ads, and to customize your site experience!

Printing word document from command Prompt

Overclockers is supported by our readers. When you click a link to make a purchase, we may earn a commission. Learn More.

pogue1000

Member
Joined
Nov 28, 2001
Location
Indiana
I need help with a prompt to open a word document on the network and to print it. I want the opening of the file to be hidden from the user.

Thanks :shrug:
 
You can do this with visual basic script. If Word is installed on the computer you can use the Word.Application class to open a hidden Word window and tell it to print. It would be something like this:

Code:
Set WordObj = CreateObject("Word.Application")
WordObj.Visible = False
Set WordDocument = WordObj.Documents.Open(WScript.Arguments(0))
WordDocument.PrintOut()
WordDocument.Close()
WordObj.Quit()

This script will take a single command line argument and print that file using word.
 
Last edited:
Thanks! I actually found a template for my developing environment(clarion) that allows control of the word class.

mccoyn said:
You can do this with visual basic script. If Word is installed on the computer you can use the Word.Application class to open a hidden Word window and tell it to print. It would be something like this:

Code:
Set WordObj = CreateObject("Word.Application")
WordObj.Visible = False
Set WordDocument = WordObj.Documents.Open(WScript.Arguments(0))
WordDocument.PrintOut()
WordDocument.Close()
WordObj.Quit()

This script will take a single command line argument and print that file using word.
 
type doxument.doc >LPT1 would work as well. As far as hiding it from a user? Sounds sketchy.....buuuuuuut I think that since it's DOS that NTFS would put a timestamp on the file access.
 
Back