本帖最后由 pcl_test 于 2015-2-14 15:44 编辑
回复 1# antyison
把批处理跟txt文件放在一起运行,测试前先备份原文件- @echo off
- setlocal enabledelayedexpansion
- for /f "delims=" %%a in ('dir /b *.txt') do (
- for /f "tokens=1* delims=:" %%i in ('findstr /e /n "," "%%a"') do set m=%%i
- set n=1
- for /f "delims=" %%s in ('type "%%a"') do (
- set "str=%%s"
- if !n! == !m! (
- >>$ echo,!str:~0,-1!
- ) else (
- >>$ echo,!str!
- )
- set /a n+=1
- )
- move $ "%%a"
- )
- pause
复制代码
|