简体   繁体   English

Windows Batch:回显问题

[英]Windows Batch: echo problems

I was trying to write multiple lines with a batch file like this-> 我试图用这样的批处理文件写多行

@echo off
(
echo 123()
echo abc
) > exampleFile

the problem is in the third line of the code: 问题出在代码的第三行:

echo 123()

I think its the closing ) . 我认为即将结束

How to prevent this? 如何预防呢? Is there any kind of c or c++ like escape characters for the echo command? echo命令是否有任何c或c ++之类的转义字符? Thanks for help, true. 谢谢您的帮助,是的。

Escape with a caret; 用尖号逃脱

@echo off
(
echo 123(^)
echo abc
) > exampleFile
@echo off
setlocal enableDelayedExpansion
set "for_echo=123()"
(
echo !for_echo!
echo abc
) > exampleFile
endlocal

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM