Can't run custom script as external diff tool within sourcetree

I've successfully used a custom external diff tool (an exe) for Sourcetree within Windows. That was super simple. Just put the exe path with backslashes and the two bare arguments in the arguments. However, I've tried a batch file, a shell script and a perl script as my external diff tool without success.

Currently, I've tried putting quotes around the diff command, used forward, backwards and double backwards slashes in the path. I've also tried the same variations on the arguments, including:

\"$REMOTE\" \"$LOCAL\"

Nothing seems to work. Each of the 3 scripts I've written just echo the variables passed to the script. This way I can begin developing my custom diff invocation. Here's the perl script I'm currently using

# get total arg passed to this script
my $total = $#ARGV + 1;
my $counter = 1;
# get script name
my $scriptname = $0;
print "Total args passed to $scriptname : $total\n";
# Use loop to print all args stored in an array called @ARGV
foreach my $a(@ARGV) {
	print "Arg # $counter : $a\n";

print "Press ENTER to exit:";

Running "perl c:\devtools\ asdf jkl;" results in:

C:\devtools>perl asdf jkl;
Total args passed to : 2
Arg # 1 : asdf
Arg # 2 : jkl;
Press ENTER to exit:

My current sourcetree diff command is:

perl C:\devtools\

with arguments:


I've been working on this for a long time and I can't even get a command window to pop up!

1 answer

1 accepted

This widget could not be displayed.

Managed to get this to work. Sourcetree suppresses the command window, so that was my problem. I set up the perl script to write to a file and things worked from there.

Suggest an answer

Log in or Sign up to answer
Atlassian Summit 2018

Meet the community IRL

Atlassian Summit is an excellent opportunity for in-person support, training, and networking.

Learn more
Community showcase
Posted Wednesday in Teamwork

What teamwork quotes inspire you?

Hey everyone! My name is Natalie and I'm an editor of the Atlassian Blog and I've got a question for you: What's your favorite quote about teamwork?  We've compiled a list here, along with...

142 views 16 7
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you