本帖最后由 pcl_test 于 2015-3-5 01:54 编辑
回复 3# 思想之翼 - @echo off
- setlocal enabledelayedexpansion
- cd /d "D:\数据1\"
- if not exist "D:\数据2\" md "D:\数据2\"
- for %%a in (*_1.txt) do (
- set "fn=%%~na"
- set "fn=!fn:~,-1!"
- if exist "!fn!2.txt" (
- for /f "delims=" %%b in ('type "%%a"') do (
- set /p str=
- echo,%%b!str!
- )
- )<"!fn!2.txt">"D:\数据2\!fn:~,-1!.t"
- )
-
- cd /d "D:\数据2\"
- for %%a in (*.t) do (
- cd.>"%%~na"
- for /f "delims=" %%b in ('type "%%a"') do (
- >$ echo,%%b
- set s=
- for %%c in (1 2 3 4 5 6 7 8 9 0) do (
- findstr "%%c" $ >nul || set "s=!s!%%c"
- )
- if not "!s:~2,1!" == "" if "!s:~3,1!" == "" (
- findstr "!s!" "%%~na" >nul || >>"%%~na" echo,!s!
- )
- del $
- )
- ren "%%~na" "%%~na.txt"
- )
- del *.t
- pause
复制代码
|