There is no need to automate Word, which is rather slow and fragile due to pop-up messages or using Microsoft Office File Converter (ofc.exe), which has an unnecessarily complicated user interface.
The easiest and fastest way is to install either Office 2007, or download and install the Microsoft compatibility package (if you haven’t already). Then you can easily convert from .doc to .docx using the following command:
"C:\Program Files\Microsoft Office\Office12\wordconv.exe" -oice -nme <input file> <output file>
where <input file> and <output file> must be fully qualified path names.
The command can be easily applied to multiple documents with for :
for %F in (*.doc) do "C:\Program Files\Microsoft Office\Office12\wordconv.exe" -oice -nme "%F" "%Fx"
Dirk vollmar
source share