Last active
November 10, 2015 07:47
-
-
Save piers7/91fdffc3d8ed9eb6e1e7 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# .Synopsys | |
# Sets up Beyond Compare professional as Diff tool for all instances of Visual Studio on this PC | |
# If you don't use TFS, change the sccProvider as appropriate | |
[CmdLetBinding()] | |
param( | |
$bcPath = 'C:\Program Files (x86)\Beyond Compare 3\BComp.exe', | |
$sccProvider = 'TeamFoundation' | |
) | |
$ErrorActionPreference = 'stop'; | |
$baseKey = 'REGISTRY::\HKCU\Software\Microsoft\VisualStudio\*' | |
function SetRegKeyProperties($keyPath, [hashtable]$keyProps){ | |
if(!(Test-Path $keyPath)){ | |
Write-Verbose "Creating $keyPath" | |
# Force required here to recursively create registry path | |
[void] (new-item $keyPath -Type:Directory -Force); | |
} | |
foreach($prop in $keyProps.GetEnumerator()){ | |
Set-ItemProperty -Path:$keyPath -Name:$prop.Key -Value:$prop.Value; | |
} | |
} | |
$configBases = dir $baseKey | ? { $_.PSChildName -match '^\d+\.\d$' } | |
foreach($item in $configBases){ | |
Write-Host "Configuring $item" | |
$diffToolsKey = Join-Path $item.PSPath "$sccProvider\SourceControl\DiffTools" | |
SetRegKeyProperties (Join-path $diffToolsKey '.*\Compare') @{Command=$bcPath;Arguments='%1 %2 /title1=%6 /title2=%7'} | |
SetRegKeyProperties (Join-path $diffToolsKey '.*\Merge') @{Command=$bcPath;Arguments='%1 %2 %3 %4 /title1=%6 /title2=%7 /title3=%8 /title4=%9'} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Change $bcPath to 'C:\Program Files\Beyond Compare 4\BComp.exe' if using Beyond Compare 4