My requirement is to check if the file exists in a folder only when case matches the search.
I have searched the internet, also the basic command prompt help guide. I have no accurate answer. However, in the StackOverflow post: REF-Post the solution is provided by sending FileName as a variable to batch file. However, I would like to search the file by not using any variable sent to the Batch file.
@echo off
dir /b /a-d "%~1"|find "%~1" >nul
if %errorlevel% == 0 (echo found) else (echo fail)
This code takes %~1 value and I want to substitute %~1 with a path directly! Please help with the solution
For example: a file named testfile.txt exists in folder C:\Files\ Logic should be something like below:
IF EXIST C:\Files\TESTFILE.txt (
echo file of case exists
) else (
echo file of this case does not exist
)