sdc248
asked on
Batch file to find a file with certain name in a folder
Hi:
I need some dos command for finding a file in a folder. Here's what I have:
set OUTPATH="C:\Output"
for /f %%E in ('DIR /B %OUTPATH%\MyFile_*') do set FILENAME=%%E
echo %FILENAME%
It returns the name of the last file in the folder, plus an 'File Not Found' message.
Please help. Thanks.
I need some dos command for finding a file in a folder. Here's what I have:
set OUTPATH="C:\Output"
for /f %%E in ('DIR /B %OUTPATH%\MyFile_*') do set FILENAME=%%E
echo %FILENAME%
It returns the name of the last file in the folder, plus an 'File Not Found' message.
Please help. Thanks.
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
Welcome.
~bp
~bp
ASKER