将数值转换回字母

converting back the numerical value to alphabetical letters

我在这里找到了一个 batch .cmd 项目,它可以将字母转换成它的数值,就是它:

@echo off

:start

cls

color 9a

setlocal enableDelayedExpansion

echo.

set /p text=(your message) = 

set "code=!text!"

set "chars=0abcdefghijklmnopqrstuvwxyz"

for /l %%N in (1 1 26) do for /f %%C in ("!chars:~%%N,1!") do set "code=!code:%%C=%%N !"

cls

echo.

echo (your message) = !text!

echo.

echo (numeric value) = !code!

echo.

pause

goto :start

如果我键入,"i love you" 其数值将为“9 12 15 22 5 25 15 21”

我想做的是反转如果我输入某个东西的数值,它对应的字母或单词就会出现的动作。

怎么做?

只需向后退回即可

@echo off
Setlocal enableDelayedExpansion
Set "chars=0abcdefghijklmnopqrstuvwxyz"
set /p code= input code 
If "!code:~-1!" neq " " set "code=!code! "
for /L %%N in (26 -1 1) do (
  for /f %%C in ("!chars:~%%N, 1!") do set "code=!code:%%N =%%C!"
)
Echo text = !code!

菲尔