Board logo

标题: [求助]如何指針爭對特定路徑 去尋找 某個固定的檔案? [打印本页]

作者: importek2003     时间: 2008-9-26 09:53    标题: [求助]如何指針爭對特定路徑 去尋找 某個固定的檔案?
我想快尋找 INTEL.EXE ,所以請問要如何直接搜尋C:\INTEL_FOLDER\
C:\INTEL_FOLDER\INTEL1\INTEL.EXE
C:\INTEL_FOLDER\INTEL2\INTEL.EXE
目前有個程式如下:

請協助修改

set "str=INTEL.EXE"
set "drv=c"
set "n="" "
for %%a in (%drv%) do (
if exist %%a: (
for /f "delims=" %%b in ('dir /s/b/a-d "%%a:\%str%" 2^>nul') do (
set /a "n+=1"
set "_!n!=%%b"
echo !n! %%b


)
)
)

作者: moniuming     时间: 2008-9-26 10:08
@echo off
set "str=INTEL.EXE"
set "drv=c"
set "n="
for %%a in (%drv%) do (
if exist %%a: (
for /f "delims=" %%b in ('dir /s/b/a-d "%%a:\%str%" 2^>nul') do (
set /a "n+=1"
call set "_%%n%%=%%b"
call echo %%n%% %%b
)
)
)
pause

作者: importek2003     时间: 2008-9-26 18:02
Dear Moniuming,

利用你上面的程式

好像找不到檔案

麻煩你在幫我看一下

謝謝

作者: moniuming     时间: 2008-9-26 19:02
Originally posted by importek2003 at 2008-9-26 18:02:
Dear Moniuming,

利用你上面的程式

好像找不到檔案

麻煩你在幫我看一下

謝謝

两个原因:
1.文件名不对
2.不在c 盘下