I am trying to determine the path to the executable of git. Since there might be multiple executables found via PATH directories, I want to restrict the result to one path.
When using the following construct, PowerShell sets $LastExitCode to -1, although an executable was found.
$git_path = "$(where.exe git | select-object -first 1)"
I am wondering why this exit code is set?