I have just spent quite a bit of time trying to get a powershell script to be able to call an external program, I knew about the & operator and I could get it to work by calling the exe with no parameters:
& "c:\foo\MyProgram.exe"
But once I tried to add any I kept getting errors, I tried various different quotes around the strings in different permutations however I finally got it working by specifying no quotes at all:
& "c:\foo\MyProgram.exe" -firstParameter $firstParam, -secondParam $secondParam
Just thought I would share this so that someone else doesn’t spend their time trying various different quotes.
#1 by sales propsecting on January 16, 2013 - 5:51 am
Wow that was unusual. I just wrote an really long comment but after I clicked submit my comment didn’t appear. Grrrr… well I’m not writing all that over
again. Anyways, just wanted to say great blog!