1
我是PowerShell的新手。我创建其中包含一些数据的变量,我再传给到电子邮件生成:PowerShell - 管道 - 硬编码程序vs变量
$strEmailFile = "C:\Testing\SomeTextFile.txt"
cat $strEmailFile | E:\sendmail.exe -t
我的问题是我不想硬编码的电子邮件生成软件的驱动器。所以,我想的代码是这样的:
$strEmailFile = "C:\Testing\SomeTextFile.txt"
$Dir = "E:"
cat $strEmailFile | $Dir + "\sendmail.exe" -t
但我不断收到以下错误:
"Expressions are only allowed as the first element of a pipeline."
有我使用的管道,但没有硬办法码?
当你有'Send-MailMessage'时,你不需要'sendmail.exe'与PowerShell。 –