I'm fairly new to PowerShell. I've created a variable which contains some data which I then pass on to an email generator:
$strEmailFile = "C:\Testing\SomeTextFile.txt"
cat $strEmailFile | E:\sendmail.exe -t
My problem is I don't want to hard-code the drive for the email generating software. So I would like the code to be something like this:
$strEmailFile = "C:\Testing\SomeTextFile.txt"
$Dir = "E:"
cat $strEmailFile | $Dir + "\sendmail.exe" -t
But I keep getting the following error:
"Expressions are only allowed as the first element of a pipeline."
Is there a way for me to use the pipeline but not have to hard-code?
sendmail.exewith PowerShell when you haveSend-MailMessage.