我有一个参数,我传递给 IBM notes 以生成一个新的电子邮件,该电子邮件传递给notes.exe
如下:
mailto:[email protected]?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
我希望能够从 Powershell 调用它,但是当它调用notes.exe
Notes 时说There was an error processing command line arguments
如果我只是复制并粘贴上面的参数并将其放在双引号中,则它可以在 powershell 中正常工作,但是如果我将其作为变量传递,则会导致上述错误。
这里有什么东西当存储为字符串时会导致将其作为参数传递的问题吗?可能需要搜索/替换/转义的字符?
需要修剪参数字符串。
在包含参数的变量中,我需要调用它的.Trim()
函数来剪掉字符串开头和结尾的空格。在我这样做之后,它起作用了。
它需要这样:
" mailto:[email protected]?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"
并使它成为这样:
"mailto:[email protected]?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"
本文收集自互联网,转载请注明来源。
如有侵权,请联系 [email protected] 删除。
我来说两句