0

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 Answers1

1

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

Community
  • 1
  • 1
Tim Robinson
  • 50,349
  • 9
  • 115
  • 129