Skip to content
forked from ForNeVeR/ExtDiff

Compare documents using MS Word from the command line.

License

Notifications You must be signed in to change notification settings

lamabpo/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 GUI form

To run the GUI form run file start-gui.cmd: it will open form that stays on top off all windows and you can drag files from Windows Explorer to two text fields (first for old document and second for revised document). When you click "Compare" button it will start Word application with chosen documents as in command line usage and this form will loose "stay on top of all windows" property. It will regain this property after button "Clear" is clicked.

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.

About

Compare documents using MS Word from the command line.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • PowerShell 95.8%
  • Batchfile 4.2%