0

I have a parameter that I pass to IBM notes to generate a new email that is passed to notes.exe as follows:

 mailto:bob@yahoo.com?subject=For Employee Someguy Somsirname?body= Hi, Someguy%0AI am emailing you in regard to Someguy.  Unable his\her Stuff. Please contact his\her.%0A%0A           %0AThank you,%0A            %0A

I'd like to be able to call this from Powershell, but when it calls notes.exe Notes says There was an error processing command line arguments

If I just copy and paste the parameter above and put it in double quotes it works just fine from powershell, but if I pass it as a variable it results in the aforementioned error.

Is there any thing here that when stored as a string would cause an issue passing it as a parameter? Characters that might need searched/replaced/escaped?

mklement0
  • 382,024
  • 64
  • 607
  • 775
leeand00
  • 25,510
  • 39
  • 140
  • 297

1 Answers1

0

Needed to trim the parameter string.

In the variable that contained the parameters, I needed to call it's .Trim() function to clip off the space at the start and end of the string. After I did that it worked.

It takes this:

" mailto:bob@yahoo.com?subject=For Employee Someguy Somsirname?body= Hi, Someguy%0AI am emailing you in regard to Someguy.  Unable his\her Stuff. Please contact his\her.%0A%0A           %0AThank you,%0A            %0A"

and makes it this:

"mailto:bob@yahoo.com?subject=For Employee Someguy Somsirname?body= Hi, Someguy%0AI am emailing you in regard to Someguy.  Unable his\her Stuff. Please contact his\her.%0A%0A           %0AThank you,%0A            %0A"
leeand00
  • 25,510
  • 39
  • 140
  • 297