Board logo

标题: [已解决]怎么用批处理得到指定文件的路径? [打印本页]

作者: YunEr     时间: 2007-10-20 10:50    标题: [已解决]怎么用批处理得到指定文件的路径?

比如,我知道wget[1].txt的目录在C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\,然后用dir /s wget[1].txt,但是怎么样得到这个wget[1].txt的真实路径呢?

我得到了真实路径,就可以把他复制到其他盘里面了!
如下图:我在cmd里面的命令输出.

C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files\
Content.IE5>dir /s wget[1].txt
驱动器 C 中的卷没有标签。
卷的序列号是 2038-E082

C:\Documents and Settings\Administrator\Local Settings\Temporary Internet Files
\Content.IE5\I9O7CNEB 的目录

2007-10-18  17:54           774,731 wget[1].txt
               1 个文件        774,731 字节

     所列文件总数:
               1 个文件        774,731 字节
               0 个目录  7,420,198,912 可用字节

[ Last edited by YunEr on 2007-10-20 at 11:18 AM ]
作者: YunEr     时间: 2007-10-20 11:17
哈哈。自己弄好了。

for /d /r %%a in (*) do (
        if exist "%%a\wget[1].txt" set wget=%%a
)
copy "%wget%\wget[1].txt" C:\wget.txt




欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) Powered by Discuz! 2.5