- @echo off
- rem 指定待搜索的文件
- set "guxin1=guxin1.txt"
- set "guxin2=guxin2.txt"
- set path1=1
- set path2=2
- echo 正在搜索,请稍候...
-
- for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
- if exist %%a:\ (
- for /f "delims=" %%b in ('dir /a-d /s /b "%%a:\*%guxin1%" 2^>nul') do (
- if /i "%%~nxb" equ "%guxin1%" (
- echo,%%b
- set path1=%%b
- )
- )
- )
- )
- echo %path1%
-
- if %path1% equ 1 (
- exit
- )
-
- for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
- if exist %%a:\ (
- for /f "delims=" %%b in ('dir /a-d /s /b "%%a:\*%guxin2%" 2^>nul') do (
- if /i "%%~nxb" equ "%guxin2%" (
- echo,%%b
- set path2=%%b
- )
- )
- )
- )
-
- if %path2% equ 2 (
- exit
- )
-
- echo %path2%
-
- set path3=%path2:guxin2.txt=%
-
- set path5=%path2:guxin2.txt=guxin1.txt%
-
- echo %path5% .....
-
- copy %path1% %path3%
-
-
- del %path2%
-
- ren %path5% %guxin2%
-
- pause
复制代码
|