DOS批处理:强制回显单个语句?
在我的 DOS 批处理文件中,当 echo 为 ON 时,我在执行之前使用“@”符号来抑制该语句的 echo。
当回显关闭时,我应该如何强制声明回显(我希望有另一个单个字符,但欢迎所有答案)?
In my DOS batch file, I use the "@" symbol to suppress the echo of that statement before execution when echo is ON.
How should I force the echo of a statement when echo is OFF (I'm hoping for another single character, but all answers welcome)?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这是一个不如 @ 强大的解决方案:通过“echo on”然后“echo off”包围您想要回显的命令。
Here is a not as powerful solution as @ : surround the commands you want to echo by "echo on" then "echo off".
在我看来,没有办法。您可以将需要在
echo on
和@echo off
之间回显的命令包装起来,但我认为这很丑陋。另一种选择是保持echo 开启
并对您不想回显的每个命令使用@
并在不使用@
的情况下保持可回显。It seems to me that there is no way to do it. You can wrap commands you need to be echoed between
echo on
and@echo off
but this is ugly, I think. Another option is to keepecho on
and use@
for every command you don't want to echo and keeping echo-ables without@
.