请输入要查找的文件名:wo.exe 1 c:\WINDOWS\wo.exe 2 d:\commandline tools\wo.exe (”逼“一声) 查询结束 请选择...或按回车键退出. . .• 每条结果前按顺序加上数字。 • 输入数字,回车,则执行命令。直接回车就退出。 执行的命令是:例如输入 1,回车,则执行 explorer /select,c:\WINDOWS\wo.exe [ Last edited by tireless on 2008-9-20 at 12:05 AM ]
@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
@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
@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>
在Windows中,相信大家对“Explorer.exe”并不陌生!通常情况下,在“开始→运行”中输 入“Explorer.exe”命令就能以“资源管理器”方式打开“我的文档”。其实,Explorer.exe还有很多鲜为人知的参数。 命令格式 Explorer [/n][/e][[,/root],[path]][[,/select],[path filename]] 参数说明 /n表示以“我的电脑”方式打开一个新的窗口,通常打开的是Windows安装分区的根目录。 /e表示以“资源管理器”方式打开一个新的窗口,通常打开的也是Windows安装分区的根目录。 /root,[path]表示打开指定的文件夹,/root表示只显示指定文件夹下面的文件(夹),不显示其它磁盘分区和文件夹;[path]表示指定的路径。 如果不加/root参数,而只用[path]参数,则可以显示其它磁盘分区和文件夹中的内容。另外,[path]还可以指定网络共享文件夹。 /select,[path filename]表示打开指定的文件夹并且选中指定的文件,[path filename]表示指定的路径和文件名。 如果不加/select参数,则系统会用相应的关联程序打开该文件。如果[path filename]不跟文件名就会打开该文件夹的上级目录并选中该文件夹。
@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
Explorer [/n] [/e] [(,)/root,<object>] [/select,<object>] /n Opens a new single-pane window for the default selection. This is usually the root of the drive Windows is installed on. If the window is already open, a duplicate opens. /e Opens Windows Explorer in its default view. /root,<object> Opens a window view of the specified object. /select,<object> Opens a window view with the specified folder, file or application selected. Examples: Example 1: Explorer /select,C:\TestDir\TestApp.exe Opens a window view with TestApp selected. Example 2: Explorer /e,/root,C:\TestDir\TestApp.exe This opens Explorer with C: expanded and TestApp selected. Example 3: Explorer /root,\\TestSvr\TestShare Opens a window view of the specified share. Example 4: Explorer /root,\\TestSvr\TestShare,select,TestApp.exe Opens a window view of the specified share with TestApp selected.