(OS: Windows; using PowerShell)
Background
I intend to have "git pull" run from time to time by my service (i.e. Windows Service). In order to achieve it I use TortoiseGitPLink to provide git with my SSH key every time it's needed. This is done by setting the env var:
$env:GIT_SSH_COMMAND="'C:/Program Files/TortoiseGit/bin/TortoisePlink.exe' -i c:/path/to/my/key/id_rsa.ppk -pw myKeyPassword"
This works fine in general, but if I make a mistake and specify wrong path to my SSH key or wrong password, then TortoisePLink hangs indefinitely, freezing therefore my service. Also, If I stop the service, there's still TortoisePLink process hanging around.
Reading Plink's doc I found a "-batch" switch:
-batch: disable all interactive prompts
but for some reason either it is not respected or I use it in a wrong way.
Question
Is there a way to use TortoiseGitPLink to reliably provide an SSH key? By "reliably" I mean: it should fail if any pop-up appears or the key file is missing.