- Make sure IntelliJ IDEA is running.
- On the main menu, choose
Tools
>Create Command-line Launcher
. The dialog box Create Launcher Script opens, with the suggested path and name of the launcher script. You can accept default, or specify your own path. - Make notice of it, as you'll need it later. Outside of IntelliJ IDEA, add the path and name of the launcher script to your path.
- Specify the location of the IntelliJ IDEA executable in the Path system environment variable. In this case, you will be able to invoke the IntelliJ IDEA executable and other IntelliJ IDEA commands from any directory.
For more information, visit https://www.jetbrains.com/help/idea/2016.2/running-intellij-idea-as-a-diff-or-merge-command-line-tool.html
- In windows 10, if you face some warning like “Could not open/create prefs root node …” Ref: http://stackoverflow.com/questions/16428098/groovy-shell-warning-could-not-open-create-prefs-root-node Thanks to @SanthoshDhandapani for this.
I hit a problem running
git difftool HEAD~1 --dir-diff
on Windows. The files created by Git on %TEMP% are generally deleted a few seconds after the originaldiff
command has run. Looks like the problem is thatCMD /C
runs the UI and terminates itself (releasing the files) before we get a chance to finish the merge.A possible workaround is to call
pause
afteridea.bat
, e.g.:This will display the iconic "Press any key to continue . . ." message after each command and make sure that the inner
cmd
is not released until we are done.Alternatively we can run
idea.bat
withcmd //k
but I dislike the idea of not terminating the process. Distracted users can potentially open dozens of shells without noticing. Also, it gets really weird if you start the process from a different shell such as bash or PowerShell