Printing a MS Word file from cmd

梦想的初衷 提交于 2019-12-24 03:54:05

问题


Is there any way to print a .doc or .rtf file from the Windows command line silently? I am working on a receipt printing application and I would like to perform a silent automatic print using a cmd command.


回答1:


Wordpad can open rtf, doc and docx files, so you don't even need word. Then you can use wordpad's command line switch to print to the default printer. start wordpad.exe /p "path\filename.ext"




回答2:


Shell is an accepted Windows terminolgy and refers to the graphical user interface. It is known as The Windows Shell. And it can do what you want.

Set xlBook = GetObject("C:\Users\David Candy\Documents\Super.xls")
For each wsheet in xlbook.worksheets
    wsheet.printOut 
next

At its most basic.

This is VBS using COM.

The malcontents strike



来源:https://stackoverflow.com/questions/29889068/printing-a-ms-word-file-from-cmd

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!