In Windows 10 with PowerShell 7.3.3. I have a program foo.exe on my path. I can invoke it like this:
foo test I want to insert the parameter --bar before all arguments. My first thought is to create a function in my $PROFILE like this:
function foo { foo --bar @args } Obviously that doesn't work, because it results in an endless loop (the function calls itself).
How can I invoke the command/program foo from within the function foo? I'm guessing I can research and do something like the Bash $(pwd) and then create a path to the original executable, and hopefully that would bypass the function. But is there an easier way?
$or@in place of%. Try this:function foo { foo.exe --bar @args }.foo.exetrick when I stepped away. If one of you wants to write that up in an official answer, I'll accept it. Otherwise I'll write up an answer myself.--%instead of--bar, which doesn't work. ☹ See comments to stackoverflow.com/a/73650127 .