开发者

Write text file from batch file with embedded vbCRLF

开发者 https://www.devze.com 2023-01-05 08:13 出处:网络
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

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

0

精彩评论

暂无评论...
验证码 换一张
取 消