如题所述
æ¯å¦ çµèéæ å½ä»¤.doc è¿ä¸ªæ件 ä½ä¸ç¥éä½ç½®ã
ç¨DOSå½ä»¤æç´¢å°ä»¥å å¤å¶å° æå®ä½ç½® F:\å½ä»¤é\å½ä»¤.doc @echo off & color 0a
echo ç¨åºæ£å¨æ¥æ¾ä¸è¯·ç¨çâ¦â¦
for %%a in (c d e f g h i j k l m n) do (
cd /d %%a:\
for /f %%i in ('dir /s/b "å½ä»¤.doc"') do (
copy /y %%i "F:\å½ä»¤é\å½ä»¤.doc"
))
pause
::è¿æ¯ä¸ªBATæ¹å¤çï¼å°ä¸é¢ç代ç å¤å¶å°è®°äºæ¬ç¶åå¦å为1.batæè æ´å¥½ç解ç1.cmdä¹å¯ä»¥ã
::ä¸é¢ä»£ç ä¸çc d e f g h i j k l m næ¯æç´¢çç符路å¾å¦æç¥éç符就å¨æ¬å·éå¡«åç符å·æ¯æ¹å¨Dçé£å°±å¨æ¬å·éå¡«ådæå«çç符é½å»æè¿æ ·ä¼æ´èçæ¶é´å¦æä¸ç¥éä¹å¯ä»¥å¡«åä½ ç°æçç符ã
ç¨DOSå½ä»¤æç´¢å°ä»¥å å¤å¶å° æå®ä½ç½® F:\å½ä»¤é\å½ä»¤.doc @echo off & color 0a
echo ç¨åºæ£å¨æ¥æ¾ä¸è¯·ç¨çâ¦â¦
for %%a in (c d e f g h i j k l m n) do (
cd /d %%a:\
for /f %%i in ('dir /s/b "å½ä»¤.doc"') do (
copy /y %%i "F:\å½ä»¤é\å½ä»¤.doc"
))
pause
::è¿æ¯ä¸ªBATæ¹å¤çï¼å°ä¸é¢ç代ç å¤å¶å°è®°äºæ¬ç¶åå¦å为1.batæè æ´å¥½ç解ç1.cmdä¹å¯ä»¥ã
::ä¸é¢ä»£ç ä¸çc d e f g h i j k l m næ¯æç´¢çç符路å¾å¦æç¥éç符就å¨æ¬å·éå¡«åç符å·æ¯æ¹å¨Dçé£å°±å¨æ¬å·éå¡«ådæå«çç符é½å»æè¿æ ·ä¼æ´èçæ¶é´å¦æä¸ç¥éä¹å¯ä»¥å¡«åä½ ç°æçç符ã
温馨提示:答案为网友推荐,仅供参考
第1个回答 2013-09-26
以下为代码,复制到记事本里另存为:快速查找文件.bat
---------------------------------------------
@echo off
:: 快速全盘查找文件 -----------------------------------------↓
:lpKO
CLS
ECHO. && ECHO 功能 : 全盘快速查找文件(例:*.exe)支持通配符! 速度那是相当的快! && ECHO.
ECHO (注 : 输入Bar直接退出,输入Enter返回主菜单!) && ECHO.
ECHO -------------------------------------------------------------------------------- && ECHO.
set /p fileStr= → 请输入:
if "%fileStr%"=="" (
ECHO 直接回车退出
)
:: 去掉首尾空格空格
:barLeft
if "%fileStr:~0,1%"==" " set "fileStr=%fileStr:~1%"&goto barLeft
:barRight
if "%fileStr:~-1%"==" " set "fileStr=%fileStr:~0,-1%"&goto barRight
set fileStr=%fileStr%
del /q tmpResult.log
cls
ECHO. && ECHO 正在全盘查找文件"%fileStr%",请稍候...
ECHO ------------------------------------------------------------ && ECHO.
setlocal enabledelayedexpansion
for /f "delims=\" %%i in ('fsutil fsinfo drives^|find /v ""') do (
set var=%%i
set drive=!var:~-2!
fsutil fsinfo drivetype !drive!|find "固定">nul && (
for /f "tokens=*" %%j in ('dir /a-d /b /s !drive!\"%fileStr%" 2^>nul') do if not "%%j"=="" (
ECHO 查找结果 : "%%j"
ECHO 查找结果 : "%%j">>tmpResult.log
)
)
)
ECHO. && ECHO.
ECHO ------------------------------------------------------------
set /p lpSelect=是否打开查找结果?(y/n) :
if /i "%lpSelect%"=="y" (
start tmpResult.log
pause >nul
)
:lpnone
if /i "%lpSelect%"=="n" (
ECHo 这里返回主菜单
Pause > nul
)
:: 快速全盘查找文件 -----------------------------------------↑
---------------------------------------------
@echo off
:: 快速全盘查找文件 -----------------------------------------↓
:lpKO
CLS
ECHO. && ECHO 功能 : 全盘快速查找文件(例:*.exe)支持通配符! 速度那是相当的快! && ECHO.
ECHO (注 : 输入Bar直接退出,输入Enter返回主菜单!) && ECHO.
ECHO -------------------------------------------------------------------------------- && ECHO.
set /p fileStr= → 请输入:
if "%fileStr%"=="" (
ECHO 直接回车退出
)
:: 去掉首尾空格空格
:barLeft
if "%fileStr:~0,1%"==" " set "fileStr=%fileStr:~1%"&goto barLeft
:barRight
if "%fileStr:~-1%"==" " set "fileStr=%fileStr:~0,-1%"&goto barRight
set fileStr=%fileStr%
del /q tmpResult.log
cls
ECHO. && ECHO 正在全盘查找文件"%fileStr%",请稍候...
ECHO ------------------------------------------------------------ && ECHO.
setlocal enabledelayedexpansion
for /f "delims=\" %%i in ('fsutil fsinfo drives^|find /v ""') do (
set var=%%i
set drive=!var:~-2!
fsutil fsinfo drivetype !drive!|find "固定">nul && (
for /f "tokens=*" %%j in ('dir /a-d /b /s !drive!\"%fileStr%" 2^>nul') do if not "%%j"=="" (
ECHO 查找结果 : "%%j"
ECHO 查找结果 : "%%j">>tmpResult.log
)
)
)
ECHO. && ECHO.
ECHO ------------------------------------------------------------
set /p lpSelect=是否打开查找结果?(y/n) :
if /i "%lpSelect%"=="y" (
start tmpResult.log
pause >nul
)
:lpnone
if /i "%lpSelect%"=="n" (
ECHo 这里返回主菜单
Pause > nul
)
:: 快速全盘查找文件 -----------------------------------------↑