本帖最后由 pcl_test 于 2017-4-14 13:51 编辑
- @echo off&setlocal enabledelayedexpansion
- set "word1=bat"
- set "word2=cat"
- (for /f "delims=" %%a in ('findstr "%word1%.*%word2%" "1.txt"') do (
- set "str=#%%a"
- set "str=!str:%word1%=ж!"
- set "str=!str:%word2%=ж!"
- for /f "tokens=2 delims=ж" %%b in ("a!str!") do echo;%word1%%%b%word2%
- ))>"new_1.txt"
- pause
复制代码
|