
CODE: [Copy to clipboard]@echo off
for %%a in (*.txt) do (
(for /f "tokens=1,2" %%b in ('type "%%a"') do (
if "%%c" equ "乙烯" (
echo %%b %%c
echo %%b 铁矿
echo %%b 铜矿
echo %%b 锡矿
echo %%b 镍矿
) else (
echo %%b %%c
)
))>temp
del /q %%a&ren temp %%a
)
echo 搞定!&pause>nul
| Quote: | |
|
CODE: [Copy to clipboard]回楼上:for 的用法找置顶贴子,讲的很详细@echo off
for %%a in (*.txt) do (
(for /f "usebackq tokens=1,2" %%b in ("%%~a") do (
if "%%c" equ "乙烯" (
echo %%b %%c
echo %%b 铁矿
echo %%b 铜矿
echo %%b 锡矿
echo %%b 镍矿
) else (
echo %%b %%c
)
))>temp
del /q "%%~a"
ren temp "%%~a"
)
echo 搞定!&pause>nul
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |