如何在“回声"上回声或“关闭"纯文本? [英] how to echo "on" or "off" text only?

查看:69
本文介绍了如何在“回声"上回声或“关闭"纯文本?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

每个人都知道,在Windows命令文件(.cmd)

Everyone knows, that in Windows command file (.cmd)

echo on
echo off

启用和禁用回显.但是,如何仅回显文本"on"或"off"呢? IE.如何发送短信

enables and disables echo. But how to echo only text "on" or text "off"? I.e. how to send text

on
off

stdout?
目标系统:Windows XP.
在DOS中制作呢?

to stdout?
Target system: Windows XP.
And what about making it in DOS?

推荐答案

C:\> echo.on
on
C:\> echo.off
off

这实际上适用于许多不同的字符,包括但不限于:

This actually works with a number of different characters, including but possibly not limited to:

/\,:;(.

根据dostips.com上的此线程,实际上是最好的(最可靠):

According to this thread on dostips.com, it's actually best (most robust) to use:

echo(on

由于其他字符在某些情况下会出现故障(例如%PATH%上存在一个名为echo的文件).

As the other characters have obscure situations in which they can fail (e.g. a file named echo exists on %PATH%).

这篇关于如何在“回声"上回声或“关闭"纯文本?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆