Automation: how to automate transforming .doc to .docx?

后端 未结 5 1975
庸人自扰
庸人自扰 2020-12-09 05:54

I have a bunch of .doc files in a folder which I need to convert to .docx.

To manually convert the .doc to .docx is pretty simple:

  1. Open .doc in Word 20
5条回答
  •  [愿得一人]
    2020-12-09 06:28

    There is no need to automate Word, which is rather slow and brittle due to pop-up messages, or to use Microsoft's Office File Converter (ofc.exe), which has an unnecessarily complicated user interface.

    The simplest and fastest way would be to install either Office 2007 or download and install the Compatibility Pack from Microsoft (if not already done). Then you can convert from .doc to .docx easily using the following command:

    "C:\Program Files\Microsoft Office\Office12\wordconv.exe" -oice -nme  
    

    where and need to be fully qualified path names.

    The command can be easily applied to multiple documents using for:

    for %F in (*.doc) do "C:\Program Files\Microsoft Office\Office12\wordconv.exe" -oice -nme "%F" "%Fx"
    

提交回复
热议问题