Skip to content
/ ExtDiff Public
forked from ForNeVeR/ExtDiff

Compare documents using MS Word from the command line.

License

Notifications You must be signed in to change notification settings

coor/ExtDiff

 
 

Repository files navigation

ExtDiff Status Aquana

This is a small command line script that will compare two files using Microsoft Word file comparison tool. Microsoft Word will be started using COM automation.

It is useful as a diff tool for Word-related file types.

Using via command line

To run the script, execute it through PowerShell like this:

$ powershell -File Diff-Word.ps1 oldfile.docx newfile.docx

Or via the batch file:

$ diff-word.cmd oldfile.docx newfile.docx

Using the GUI form

UI Form Screenshot

To run the GUI form, run the script start-gui.cmd: it will open a form that stays on top of all the system windows, and you can drag files from Windows Explorer to two text fields (first for the old document, and second for the revised document). When you click the Compare button, it will start Word application with chosen documents as in command line usage, and the form will lose the "stay on top of all windows" behavior. It will regain this property again after the button Clear is clicked. Multidrop will drop the first element in the box where files are dropped and the second one into the other box.

Using via Git Integration

You can also use this tool with git, so that git diff will use Microsoft Word to diff *.docx files.

To do this, you must configure your .gitattributes and .gitconfig to support a custom diff tool.

.gitattributes

To configure your .gitattributes, open or create a file called .gitattributes in your git repo's root directory. Add the following text to a new line in this file:

*.docx diff=word

It is also possible to create a global .gitattributes file that will be applied to every repository in a system. To do that, create a file .gitattributes in your home directory, and then perform the following command:

git config --global core.attributesfile ~/.gitattributes

.gitconfig

To configure your .gitconfig, open or create the file in your home directory. Then, add the following to your .gitconfig:

[diff "word"]
	command = <pathToExtDiffFolder>/diff-word-wrapper.cmd

Replace <pathToExtDiffFolder> with the path to this repo's location on disk.


Idea taken from TortoiseSVN diff-doc script.

Additional Documentation

About

Compare documents using MS Word from the command line.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • PowerShell 95.0%
  • Batchfile 5.0%