I am using a batch file to write a vbs email file. I am unable to create the text body of the email which includes the vbCRLF code. When the TextBody is written to the Target file, it has executed the first vbCRL开发者_如何学GoF, and the DOS returns errors as it tries to execute the second vbCRLF and the last string. Enclosing it in doucble quotes doesn't work.
echo.TextBody = "Hello,blah blah blah" & vbCrLf & vbCrLf & "worldblah blah", 0, "Message">>Target.txt
The vbCRLF are used to foamt a lengthy text body for the email.
Your help is appreciated.
Replace the & with ^&:
echo.TextBody = "Hello,blah blah blah" ^& vbCrLf ^& vbCrLf ^& "worldblah blah", 0, "Message">>Target.txt
It's related to this: Escape angle brackets in a Windows command prompt
精彩评论