Compare files extension PowerShell script assumes all tools are installed in %ProgramFiles%
I was baffled why all of a sudden there's error "Cannot find WinMerge" when using File Custom Commands > Compare Files. Went to investigate the PowerShell script CompareFiles.WinSCPextension.ps1 and discovered that it's looking for comparison tool executables in
The issue is that I've installed WinMerge using winget for my user only in user programs directory –
This is not a one-off or edge case because any program could be installed as a user-only install or installed anywhere on the system, like when using Scoop package manager applications reside under
To add to the point, my WinSCP install is in
IMHO, the script should use
$env:ProgramFiles
or $env:ProgramW6432
and doesn't even try to use $env:PATH
or PowerShell built-in Get-Command
.
The issue is that I've installed WinMerge using winget for my user only in user programs directory –
%LocalAppData%\Programs\Winmerge
.
This is not a one-off or edge case because any program could be installed as a user-only install or installed anywhere on the system, like when using Scoop package manager applications reside under
%UserProfile%\scoop\apps
and executable shims are placed in %UserProfile%\scoop\shims
directory which is added to %PATH%
.
To add to the point, my WinSCP install is in
%LocalAppData%\Programs\WinSCP
and added to the PATH
.
IMHO, the script should use
Get-Command
to check if the selected tool is in %PATH%
and have an option to specify full path for a tool in the custom command settings UI.