嘿嘿
输出到文本的方法有两种
一是用变量拼接起来再用echo输出
不过如何综合处理各种特殊字符挺考验人的
- @echo off & setlocal EnableDelayedExpansion
- set line=-
- for /f "tokens=*" %%l in ('more +6 %~sf0') do set line=!line!%%l
- >test1.txt echo %line:~1%
- pause & goto :eof
-
-
-
- test0:
- =test1:
- "test2:
- "test3":
- ^test4:
- !test5!:
- %test6%:
- test7
复制代码
二是直接使用ASCODE生成的特殊echo输出
但如果在意控制键盘代码和字符集切换就比较麻烦
- @echo off & chcp 437>nul & graftabl 936>nul
- ECHO ,HP_,6P-B~1En0eqZ[SCj@_YQ2M@-@BINNNNN~BO!A>ECHO-.COM
- echo- ->nul
- (for /f "tokens=*" %%l in ('more +6 %~sf0') do echo- %%l)>test2.txt
- del echo-.com
- goto :eof
- test0:
- =test1:
- "test2:
- "test3":
- ^test4:
- !test5!:
- %test6%:
- test7
复制代码
|