I had previously figured out a semi-automated command-line solution to the question of how to convert many Microsoft Word docs to PDF. This process involved automatically opening, printing, and closing the files, one at a time, in Word. Now I had another set of documents to convert. So the first purpose of this post was to boil down what I wrote up in that previous post.
The second purpose was to see if the same approach would work for WordPerfect (.wpd) docs. The logic was that Word could handle WPDs, and that it would automatically convert them upon opening. So it seemed that I should be able to run an almost identical command to convert a document, regardless of whether it was a WPD or a DOC (or, presumably, an RTF, or a DOCX, etc.).
The command I used was long, but not super-complicated. This was the one-line command I used to convert all of the DOC files in a folder:
FOR /F "usebackq delims=" %%g IN (`dir /b "*.doc"`) DO "C:\Program Files (x86)\Microsoft Office\Office11\winword.exe" "%%g" /q /n /mFilePrintDefault /mFileExit && TASKKILL /f /im winword.exeIts success depended on several factors. Some, such as cleaning out the %Temp% folder, are detailed in the previous post. I structured the command with the aid of early answers to a question I posted.
It is worth noting that the command could be used to specify various kinds of files. This example referred to *.doc (that is, to all .doc) files in the folder in which it the command was run. (It goes without saying that it would be wise to have a backup before fooling with this or any command.) Also, I set my PDF printer (Bullzip > Options > General and Dialogs tabs) to operate without asking me any questions. Note, further, that the precise location of winword.exe would vary, from one system to another. Of course, saving the command as the entire contents of an executable batch file was just a matter of putting it into a text file with a .bat extension, and then saving and running that .bat file.
I tried modifying the command to refer to .wpd rather than .doc, and ran it in a folder full of WPDs. It worked. Then, as detailed elsewhere, I did a file count to verify that I had the right number of resulting PDFs, and ran Boxoft PDF to JPG Converter to do a quick test, highlighting files that didn't look right. This process worked with WPDs.
I wasn't sure how much further the command could be extended. A test with PPTs (using PowerPoint rather than Word) failed. In response to my follow-up question regarding the possibility of specifying the filetype on the command line (by typing e.g., CONVERTER.BAT DOC), it was suggested that I simply experiment to see if I could get the variable ("DOC," in that example) to work. I didn't have any more files to work on at the moment, so that investigation would have to wait until later.