回声在Windows -e相同呢? [英] echo -e equivalent in Windows?

查看:112
本文介绍了回声在Windows -e相同呢?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否有任何Linux回声-e相当于在windows,所以我可以用回声-e \\ xnnn来打印的ASCII code是十六进制值NNN?字符

Is there any Linux "echo -e" equivalent in windows so I can use "echo -e \xnnn" to print out the character whose ASCII code is the hexadecimal value nnn ?

推荐答案

有没有类似的,但你可以编写自己的功能。

There is no equivalent, but you can write your own function.

我会分裂问题分成两部分。结果,
转换的十六进制数为十进制。结果
转换十进制数为ASCII。

I would split the problem into two parts.
Convert the hex number to decimal.
Convert the decimal number to ASCII.

从十六进制到十进制转换是通过简单

Converting from hex to decimal is simple by

set "myHex=4A"
set /a decimal=0x%myHex%

转换一个数字到ASCII更加棘手,这取决于所需的ASCII范围的搜索
如果你只需要从32(空格)126'〜'的范围内,你可以使用众所周知=退出codeAscii变量

Converting a number to an ASCII is more tricky, it depends of the required ASCII-range
If you only need the range from 32 (space) to 126'~', you could use the well known =ExitCodeAscii variable

set "decimal=%1"
cmd /c exit /b %decimal%
echo "%=ExitCodeAscii%"

如果您还需要一些特殊的字符,如CR,LF,ESC,DEL,可以用纯批量创建。

If you need also some special characters like CR, LF, ESC, DEL, it is possible to create them with pure batch.

如果你需要更多的比你能使用VBScript。

If you need more than you could use vbscript.

这篇关于回声在Windows -e相同呢?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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