
| Quote: | |
|
CODE: [Copy to clipboard]@echo off
setlocal enabledelayedexpansion
set /p str=请输入要查找的文件名:
set "drv=c d e f g h i j k l m 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
)
)
)
echo
echo 查询结束...
:here
set "var="
set /p var=请选择:
if not defined var exit
start "" "!_%var%!"
goto :here
CODE: [Copy to clipboard]@echo off
set /p file=请输入要查找的文件名:
if "%file%" equ "" (
goto :eof
) else if "%file%" equ "1" (
start explorer /select,c:\WINDOWS\wo.exe
goto :eof
)
>"a.txt" type nul
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: (
for /r %%a: %%h in (%file%) do (
>>"a.txt" echo %%h
)
)
)
findstr /n .* "a.txt"
echo
CODE: [Copy to clipboard]@echo off
set /p file=请输入要查找的文件名:
if "%file%" equ "" (
goto :eof
) else if "%file%" equ "1" (
start explorer /select,c:\WINDOWS\wo.exe
goto :eof
)
>"a.txt" type nul
for %%a in ("%file%") do (
set name=%%~na
set ext=%%~xa
)
set ext=%ext:~1%
for /f "skip=1 delims=" %%a in ('wmic datafile where "filename='%name%' and Extension='%ext%'" get name /value') do (
>>"a.txt" echo %%a
)
findstr /n .* "a.txt"
echo
echo 查询结束
echo.
echo 请选择...或按回车键退出. . .
pause>
| Quote: | |
|
CODE: [Copy to clipboard]太感谢楼主和HAT了,要不还真不知道explorer还有参数,谢谢两位!!!@echo off
setlocal enabledelayedexpansion
set /p str=请输入要查找的文件名:
echo.
set "drv=c d e f g h i j k l m 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
)
)
)
echo
echo 查询结束...
:here
set "var="
set /p var=请选择...或回车退出...:
if not defined var exit
explorer /select,"!_%var%!"
goto :here
| Quote: | |
|
| 欢迎光临 中国DOS联盟论坛 (http://cndos.fam.cx/forum/) | Powered by Discuz! 2.5 |