CODE: [Copy to clipboard]
@echo off&setlocal enabledelayedexpansion
for /f "tokens=1,2" %%I in (code.ini) do set #%%I=%%J
for /f "delims=" %%I in (TestFile.txt) do (
set line=%%I&set newline=
for /l %%x in (0,1,1000) do if "!line:~%%x,1!" neq "" call:sub !line:~%%x,1!
echo !newline!
)
:sub
if "%1" equ "" (set "newline=%newline% "&goto:eof)
set "newline=%newline%!#%1! "
goto:eof
fix: 每個間單詞編碼後用空格分開。CODE: [Copy to clipboard]
@echo off&setlocal enabledelayedexpansion
for /f "tokens=1,2" %%I in ('more +12 "%~f0"') do set #%%I=%%J
:begin
set newline=
set/p line=Please input a string:
for /l %%x in (0,1,1000) do if "!line:~%%x,1!" neq "" call:sub !line:~%%x,1!
echo.string: !line!&echo.enCode: !newline!&echo.!newline!>>encode$$$.txt
goto:begin
:sub
if "%1" equ "" (set "newline=%newline% "&goto:eof)
set "newline=%newline%!#%1! "
goto:eof
A .-
I ..
Q --.-
Y -.--
7 --…
B -…
J .---
R .-.
Z --..
8 ---..
C -.-.
K -.-
S …
1 .----
9 ----.
D -..
L .-..
T -
2 ..---
0 -----
E .
M --
U ..-
3 …--
. .-.-.-
F ..-.
N -.
V …-
4 ….-
? ..--..
G --.
O ---
W .--
5 …..
, --..--
H ….
P .--.
X -..-
6 -….
[