Open Word document from command line with additional data source parameter

允我心安 提交于 2019-12-12 13:26:31

问题


It is possible to open a word document from the command line using this:

rundll32 url.dll,FileProtocolHandler path.to.word.document.doc

Unfortunately, that document needs an external data source, so the path of that data source has to be set manually once it is opened.

Is there a more convenient way to provide an additional parameter to point to the data source?


回答1:


You can open a word document using

winword.exe <filepath>

To use winword in command prompt you need to set your path variable like this

set path=%path%;C:\Program Files\Microsoft Office\Office14



回答2:


In the cmd instance I opened the document but just typing in the document name in

"whatever it's called.docx"




回答3:


If you use PowerShell, you can type "ii FileName". For example, "ii *.docx" will open all the .docx files in the folder. It works for all types of files, not just Word documents.



来源:https://stackoverflow.com/questions/12836361/open-word-document-from-command-line-with-additional-data-source-parameter

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