标题: [文本处理] 批处理如何转换ASCII字符 [打印本页]
作者: netdzb 时间: 2019-6-2 17:10 标题: 批处理如何转换ASCII字符
比如吧0123456转成30313233343536,应该写代码?
作者: amwfjhh 时间: 2019-6-2 17:42
本帖最后由 amwfjhh 于 2019-6-2 18:37 编辑
- @echo off
- set strLN=
- set "str=0123456中文应该....多少字符呢...."
- >tmp.txt set /p=%str%<nul
- for /f "tokens=3,*" %%i in ('dir tmp.txt ^| findstr 个文件') do (
- set /a "nLen=%%i"
- )
- set "strCmp="
- for /l %%i in (1 1 %nLen%) do (
- call set "strCmp=%%strCmp%%%%strLN%%"
- )
- >$ set /p=%strCmp%<nul
- set "strASC="
- for /f "skip=1 tokens=2 delims=: " %%i in ('fc /b tmp.txt $') do (
- call set "strASC=%%strASC%%%%i "
- )
- echo,%strASC%
- del /f tmp.txt >nul 2>nul
- del /f $ >nul 2>nul
-
- pause
复制代码
作者: Batcher 时间: 2019-6-2 19:21
试试:
http://bbs.bathome.net/thread-586-1-1.html
http://bbs.bathome.net/thread-18875-1-1.html
欢迎光临 批处理之家 (http://www.bathome.net/) |
Powered by Discuz! 7.2 |