I have a script that searches for a file name that is in the format "abc2014.txt" in a specific folder. Then I count the number of such files that have the name * 2014. But if this file is not found, then on the command line it displays the output as "File not found."
My script:
@echo off
SetLocal enabledelayedexpansion
for /F "tokens=1" %%a IN ('Dir "C:\Users\BOX\*2014*" /-C/S/A:-D') Do Set q=!n2! & Set n2=%%a
echo %q%
I do not want this output "File not found". How to suppress this output "File not found"? If there is no file there, I want to get blank .
How to achieve this?
source
share