Command prompt for merging word documents - merge

I have two word documents and I need to merge them into one word document using command prompt. Option copy *.extension newfile.extensions works with .txt or .csv file but if I do that with docx result of operation is corrupted word file.

You won't be able to achieve what you want (with command copy) as merging two word documents is a bit more subtle than just do a 'bit wise append' (which is what the copy command does).
Google give quite a few result when searching for 'merge word documents'. One of the result might point you to a tool that you can invoke at the command line.
Hope this helps.

I have need of something similar, and this was the best I could find: https://github.com/jamessantiago/DocxMerge
I haven't tried it yet, but from all I can tell there is no command line option for combining Word documents.
(Good to know: The .docx file is actually a zip file. Rename it to .zip and unzip it to view what's inside. Combining two documents is tricky, but obviously possible, from command line. But there is no built-in command to do it.)

Related

window command prompt for searching

When you use window and go to a folder, there will be a search box and when you write something there, windows will automatically search the folder and all subfolders inside it for the keyword (it searches the title and the content of all documents also).
I just wonder if there is a way to perform that similar action but in command prompt (I want to search all types of file: pdf, txt,...)
I have tried find and findstr but findstr only searches text file and for find it returns wrong result for me. Because I know for sure that for example the word 'dangerous' is in a document but the result from find is 0
Do you want it to search the filenames for the keyword or the actual contents of the file? In such case i think you will need to write a simple c++ program to stream the data of each file and search for the keyword that way

GNU Diff Utility report as Differ where Files are Same

I have installed diffutils-2.8.7-1.exe in Windows XP System.
I have created a MS Office Word Document with some text and an image.
Scenario 1:
Command: diff --report-identical-files "file1.doc" "file1.doc"
It gives the output as "Identical".
Action: Now i have copy pasted the file1.doc.
Scenario 2:
Command: diff --report-identical-files "file1.doc" "Copy of file1.doc"
It gives the output as "Identical".
Action: Now i have opened the file1.doc and Save As file2.doc
Without doing any modification in the content.
Visually both files look identical.
Scenario 3:
Command: diff --report-identical-files "file1.doc" "file2.doc"
It gives the output as "Differ".
Query: Could anyone please explain how it can happen ??
Is diff utility checks something beyond the content of the document ??
The reason for two .doc files to be different even if their contents are identical is that there are additional metadata saved in the file, and these metadata differ.
Unless you use some more intelligent comparison tool, you are out of luck. diff does not understand at all the .doc file format and thus compares every byte individually, unable to ignore what you consider as insignificant.

How to append 2 word documents into 1 using the command line (no vba)

I'm trying to find a simple solution to append 2 MSWord files into one using Windows 7 command line /batch file only (no vba).
I already tried
copy /B /Y file1.doc+file2.doc=file3.doc
but file3.doc only gets the contents of file1.doc, but not file2.doc.
Copy works just fine with text documents, but is not working for me on MSWord documents.
Any ideas on how I can accomplish that from the command line?
If doing that in a vb script is simple, I might do it in vb and forget about my batch file approach.
You can concatenate text files via copy, because the files contain just text without additional structural information. That does not apply to Word documents, though. I'm afraid what you want cannot be done without resorting to VBA.

Printing Multiple Files in one Print Job

I have a program that will output timesheets as separate .xps files into a folder. I am looking for a way to use the command line to print all of these files at the same time. Since there could be hundreds of these files it is also important that they be printed as one print job so that other documents aren't printed in the middle of them.
I have been searching on and off for about two months for a way to do this. So far I have come up with nothing. I would appreciate any advice on how to do this.
Thanks.
I ended up converting my files to PDFs. Then I downloaded pdftk which is a command-line tool that can be used to combine multiple PDF files into one. Now I can just run pdftk and then print the combined file. It's unfortunate that there is not a better way to handle this in Windows but at least it works.

How to save a document in ms word 2003 using command prompt?

Please help, How to save a document in ms word 2003 using command prompt?
The only thing I know about cmd is making a directory(mkdir), open ms word(win word), and hide rar files to jpeg files. And moving files from 1 directory to another.
You can open Word document from the command prompt (starting a new Word process), but there is no easy way of sending any commands to a runnning instance of Word by a simple command line script. If you want to save Word documents programmatically, you can, for example, use VBA ("macros") or VBScript for it. But it would make much more sense if you change the Word document programmatically before, so I suggest that you first make yourself comfortable with VBA.
AFAIK there's no direct way to send a command from command line to words UI. You have to imploy a tool or trick here:
Using an autostart macro was sufficient if you want to convert data like opening a txt or html file with the command line and save it as a doc file with the autostart macro. It may even work to shut word down again within that autostart macro.
Another possibility is a kind of Win-GUI-recorder like AutoIT. This can create scripts or exes containing a script that record some actions you have previously shown it yourself (and much much more). Take a look at their pages at http://www.autoitscript.com/autoit3/.
And a third possibility is Word's ActiveX-IF that can be acessed by any programming system (even AutoIT).
Greetings from Germany!
LuI