如何打开在CMD中搜索到的文件
How to open the file that was searched in CMD
我在命令提示符下使用
搜索了一个文件
dir /s *584.pdf
找到文件,结果如下
Volume in drive Z is New Volume
Volume Serial Number is E49F-4208
Directory of Z:\OHE_Design\DFCC\EMP-4 OHE\Submissions\References\Received\CTP-1 & 2-Bridge Mast files\CTP 1 & 2 DETAILS\OHE approval letters\L-NKC-SLT-PMC-1612-48
12/14/2016 05:11 PM 8,180,090 2-MB-13-011-OHE_Rev.0 584.pdf
1 File(s) 8,180,090 bytes
Total Files Listed:
1 File(s) 8,180,090 bytes
0 Dir(s) 47,574,523,904 bytes free
现在,我想打开我搜索的文件,有什么命令可以做到这一点吗?我该如何进行?
for /r "Z:\OHE_Design" %%a in ("*584.pdf") do (
start "" "%%~fa"
)
试试这个。
我尝试了一些代码,幸运的是它似乎对我有用。
@echo off
set /p search="Enter the file : "
cd "C:\users\suneel\desktop\Potato 23"
dir /s /b /a-d "*%search%*.pdf">"test.txt"
if '%ERRORLEVEL%'=='0' GOTO OPEN
if '%ERRORLEVEL%'=='1' echo Please search manually or Confirm with Authorities
:CONT
del "test.txt"
PAUSE
EXIT
:OPEN
set /p extract=<"test.txt"
start "" "%extract%"
echo FILE FOUND
echo Please wait while the file opens.
GOTO CONT
我在命令提示符下使用
搜索了一个文件dir /s *584.pdf
找到文件,结果如下
Volume in drive Z is New Volume
Volume Serial Number is E49F-4208
Directory of Z:\OHE_Design\DFCC\EMP-4 OHE\Submissions\References\Received\CTP-1 & 2-Bridge Mast files\CTP 1 & 2 DETAILS\OHE approval letters\L-NKC-SLT-PMC-1612-48
12/14/2016 05:11 PM 8,180,090 2-MB-13-011-OHE_Rev.0 584.pdf
1 File(s) 8,180,090 bytes
Total Files Listed:
1 File(s) 8,180,090 bytes
0 Dir(s) 47,574,523,904 bytes free
现在,我想打开我搜索的文件,有什么命令可以做到这一点吗?我该如何进行?
for /r "Z:\OHE_Design" %%a in ("*584.pdf") do (
start "" "%%~fa"
)
试试这个。
我尝试了一些代码,幸运的是它似乎对我有用。
@echo off
set /p search="Enter the file : "
cd "C:\users\suneel\desktop\Potato 23"
dir /s /b /a-d "*%search%*.pdf">"test.txt"
if '%ERRORLEVEL%'=='0' GOTO OPEN
if '%ERRORLEVEL%'=='1' echo Please search manually or Confirm with Authorities
:CONT
del "test.txt"
PAUSE
EXIT
:OPEN
set /p extract=<"test.txt"
start "" "%extract%"
echo FILE FOUND
echo Please wait while the file opens.
GOTO CONT