views:

28

answers:

1

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 vbCRLF, 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.

+1  A: 

Replace the & with ^&:

echo.TextBody = "Hello,blah blah blah" ^& vbCrLf ^& vbCrLf ^& "worldblah blah", 0, "Message">>Target.txt

It's related to this: http://stackoverflow.com/questions/251557/escape-angle-brackets-in-a-windows-command-prompt

Tim Robinson