更新时间:2023-12-05 17:54:22
这可以使用cmd脚本语言的关联数组来完成:
this can be done with cmd script language's associative arrays:
@ECHO OFF &SETLOCAL ENABLEDELAYEDEXPANSION
SET "text=This is my zero text example"
SET "alfa=0abcdefghijklmnopqrstuvwxyz"
FOR /l %%x IN (1,1,26) DO SET "$!alfa:~%%x,1!=%%x"
SET /a count=0
:loop
SET "char=!text:~%count%,1!"
SET "code=!$%char%!
SET /a count+=1
IF DEFINED char SET "line=!line!%code% "&GOTO :loop
ECHO %text%
ECHO %line%
输出:
Output:
This is my zero text example
20 8 9 19 9 19 13 25 26 5 18 15 20 5 24 20 5 24 1 13 16 12 5