스크립트가 예상대로 작동합니다
하지만 ▲
및 ▼
하지 ASCII 제어 코드입니다 :
▲ U+25B2 Black Up-Pointing Triangle
▼ U+25BC Black Down-Pointing Triangle
불행하게도, 어느 ASCII 제어 코드 30
(RS)도 ASCII 코드 31
(미국) 여기에서 볼 수 있습니다; 따라서 16 진수 편집기에서 다음 스크린 샷을 삽입했습니다. 다음 스크립트에서는 mycharmap.bat
스크립트의 다음 출력을 허용 가능한 길이로 유지하기 위해 bgnstr
변수가 약간 짧아집니다.
@ECHO OFF
SETLOCAL EnableExtensions EnableDelayedExpansion
set old=;
set "new="
set "[email protected]"
set "endstr="
> Convert.txt (
for /f "tokens=* delims= " %%a in (test1.txt) do (
set str=%%a
set str=%BGNSTR%!str:%old%=%new%!%endstr%
echo !str!
)
)
입력/출력 :
==> type test1.txt
a;b;c
d;e;f;
h;i;j
==> D:\bat\SO\39006271.bat
==> type Convert.txt
@TSabc
@TSdef
@TShij
ASCII 제어 코드 type Convert.txt
출력에서 상기 보이지; 다음 코드의 mycharmap.bat
스크립트와 그 다음 스크린 샷을 보여줍니다. mycharmap.bat
스크립트는 superuser.com에이 내 대답에서 온다 : Full description of Windows Alt+x codes
==> for /F "skip=2 delims=" %G in ('type Convert.txt') do @mycharmap.bat "'%G'"
Ch Unicode Alt? CP IME Alt Alt0 IME 0405/cs-CZ; CP852; ANSI 1250
@ U+0040 64 …64… 64 064 Commercial At
T U+0054 84 …84… 84 084 Latin Capital Letter T
S U+0053 83 …83… 83 083 Latin Capital Letter S
U+001E …30… 030 Information Separator Two
U+001E …30… 030 Information Separator Two
U+001E …30… 030 Information Separator Two
h U+0068 104 …104… 104 0104 Latin Small Letter H
U+001E …30… 030 Information Separator Two
i U+0069 105 …105… 105 0105 Latin Small Letter I
U+001E …30… 030 Information Separator Two
j U+006A 106 …106… 106 0106 Latin Small Letter J
U+001E …30… 030 Information Separator Two
U+001F …31… 031 Information Separator One
@TShij
'/ F는 "토큰 = * delims ="'구분자로서 공간을 형성; 토큰'*'과 함께 선행 공백 (탭은 제외)을 제거합니다. 너 저걸 원하니? – aschipfl
변환하려고하는 파일에서 각 문자열은 자체 행에 있으므로 작업 중이 었습니다. –