本帖最后由 yhcfsr 于 2018-12-12 19:29 编辑
上个版本有BUG,遇到一些特殊英文字符会丢数据,特此更新- @echo off
-
- rem 设置源文件
- set "TXT=C:\Users\CaoFei\Desktop\test.txt"
- if not exist "%TXT%" echo;源文件不存在&pause&exit
-
- set "dd=%date:~,4%%date:~5,2%%date:~8,2%"
- set "n=101"
-
- for /f "tokens=1,*delims=:" %%a in ('findstr /n ".*" "%TXT%"') do (
- set "str=%%b"
- if "%%b"=="" set/a "n+=1"
- setlocal enabledelayedexpansion
- if "%%b" neq "" echo;!str!>>"%dd%-!n:~-2!.txt"
- endlocal
- )
- pause
复制代码
|