Você precisa escapar dos caracteres de parêntese de ()
abertos e fechados no comando ECHO
com o caractere ^
circunflexo (veja abaixo), portanto, será: @echo The build FAILED because of a lock on the 'classes' folder ^(or its subfolders^).>%FILE_MAIL_BODY%
.
@SET retval=%ERRORLEVEL%
if %retval% == 1 (
@SET FILE_MAIL_BODY=mail.body
@echo The build FAILED because of a lock on the 'classes' folder ^(or its subfolders^)^.>%FILE_MAIL_BODY%
)
Mais recursos
- Alguns caracteres, têm um significado especial para a linha de comando. Eles não podem ser impressos como texto usando o comando ECHO, a menos que tenham escapado usando o símbolo circunflexo:
- SO - Escape de caracteres em lote
- Personagens de fuga
Echoing Parentheses in Windows Batch Files
It’s not just about parentheses, really. It’s about almost anything that a script engine will ruthlessly interpret before executing a command: variable markers (percent signs), redirection symbols, parentheses, double quotes, ampersands…
My most common… let’s say, case, is this:
@echo off echo Doing something (very important)...
Put this in a BATch file, run it, and you’ll end up with a message saying
... was unexpected at this time.
No, seriously? It’s great that the engine is trying to evaluate an expression within an echo, but this time I need something much more simple: round brackets embedded into a text message. Just that. Please.
Thank heavens there is a “cure”: parentheses can be escaped with a caret character.
@echo off echo Doing something ^(very important^)...
Now we’re good:
Doing something (very important)...
Carets can be used to escape almost any special character, even a newline — to break a single command in several lines.
source