@echo off & setlocal ENABLEDELAYEDEXPANSION
for %%c in (c: d: e: f:) do (
if exist "%%c\Program Files\xj11\hal_XJQ\ws.txt" type "%%c\Program Files\xj11\hal_XJQ\ws.txt" >>r.txt
)
另外发现你的 “根目录” 概念不清,学习一下 dos 根目录的概念。
按照你的思路修改:
@echo off
for %%i in (c:,d:,e:,f:) do dir /s /b %%i\ws.txt >>filepath.txt 2>nul
for /f %%a in ( filepath.txt) do (
if /I "%%~pa" EQU "\Program Files\xj11\hal_XJQ\" TYPE "%%a" >>R.txt
)
Last edited by DXSX on 2010-9-14 at 11:48 ]