复制代码
- @echo off
- set TargetPath=\aaa\bbb\I386
- for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
- if exist "%%a:%TargetPath%" (set NeededPath=%%a:%TargetPath%)
- )
- echo !NeededPath!
- pause
是这个意思吗复制代码
- @echo off
- for %%j in (q w e r t y u i o p a s d f g h j k l z x c v b n m) do (
- if exist %%j:\nul (
- for /f "delims=" %%i in ('dir %%j:\i386 /a-d /b /s /a 2^>nul') do echo %%i
- )
- )
- pause
复制代码
- @echo off
- setlocal enabledelayedexpansion
- for /f "delims=\" %%i in ('fsutil fsinfo drives^|find /v ""') do (
- call set a=%%i
- for /f "delims=" %%j in ('dir /a /b /s !a:~-2!\War3.exe') do (
- echo %%j
- copy "%~dp0\冰峰王座\真三国无双3.9d_AI.w3x" "%%~dpj\maps\"
- copy "%~dp0\冰峰王座\DotA Allstars AI CN.w3x" "%%~dpj\maps\"
- )
- )
- echo 完成
- pause
原帖由 Seter 于 2009-11-29 10:29 发表
@echo off
for %%j in (q w e r t y u i o p a s d f g h j k l z x c v b n m) do (
if exist %%j:\nul (
for /f "delims=" %%i in ('dir %%j:\i386 /a-d /b /s /a 2^>nul') do echo %%i
)
)
pause是这个意思 ...
复制代码
- @echo off
- for %%a in (c d e f g h i j k l m n o p q r s t u v w x y z) do (
- if not defined str for /f "delims=" %%b in ('dir /ad /b /s %%a:\i386') do set "str=%%b"
- )
- echo %str%&pause>nul
复制代码
- e:\khm\I386
- d:\Program Files\Macromedia\Flash CS4\JVM\lib\i386
batman 版主的好像是 只要找到一个就结束了复制代码
- @echo off
- for %%i in (c d e f j h i g k) do (if exist %%i: (
- for /f "delims=" %%j in ('dir /b /s /ad %%i:\i386 2^>nul') do echo %%j ))
- pause
复制代码
- @echo off
- for %%i in (c: d: e: f: g:) do (
- for /f "delims=" %%a in ('dir /b /s /ad %%i\i386') do echo %%a
- )
- pause
原帖由 Seter 于 2009-11-29 10:29 发表
@echo off
for %%j in (q w e r t y u i o p a s d f g h j k l z x c v b n m) do (
if exist %%j:\nul (
for /f "delims=" %%i in ('dir %%j:\i386 /a-d /b /s /a 2^>nul') do echo %%i
)
)
pause是这个意思 ...
原帖由 bluewing009 于 2009-11-29 10:48 发表
这种网吧里的路径都不一样 ,所以我写了这个,更广泛一点。
可以针对普通要求的搜索。嘿嘿 直接把例子发上来了, 有必要的话就改改。@echo off
setlocal enabledelayedexpansion
for /f "delims=\" %%i in ('fs ...
/A Displays files with specified attributes. attributes D Directories R Read-only files H Hidden files A Files ready for archiving S System files I Not content indexed files L Reparse Points - Prefix meaning not |
原帖由 Batcher 于 2009-12-12 00:33 发表
/a-d的意思是排除文件夹,参考帮助文档:
/A Displays files with specified attributes.
attributes D Directories R Read-only files
H Hidden files ...
复制代码
- @echo off
- set TargetFolder=I386
- for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do if exist %%a:\ (
- pushd %%a:\
- for /d /r %%i in (.) do if /i "%%~ni"=="%TargetFolder%" echo %%~fi
- popd
- )
- pause
复制代码
- @echo off
- set TargetFolder=I386
- for %%a in (C D E F G H I J K L M N O P Q R S T U V W X Y Z) do (
- rem dir /ad/s/b %%a:\ 2>nul | findstr /ie "\\%TargetFolder%"
- rem 用if效率高点
- if exist %%a:\ dir /ad/s/b %%a:\ | findstr /ie "\\%TargetFolder%"
- )
- pause
欢迎光临 批处理之家 (http://bbs.bathome.net/) | Powered by Discuz! 7.2 |