I have a command line executable that I need to call repeatedly in PowerShell with different options.
On every occassion I wish to check that the exit code is 0.
Is there a way for wrapping the call and the parameters as a function?
& bob.bat -b
... error handling
& bob.bat -a -m "a path"
... error handling
Goes to something like:
function callBob ($paramList)
{
& bob.bat $paramList
... error handling
}
callBob -b
callBob -a -m "a path"
etc...
Unfortunately the above code doesn't appear to handle multiple parameters - I can't get things like the second to work, as callBob only takes a single parameter so I end up having to pass in a single string which seems to get quoted on being passed to & bob.bat.