I want to create a Windows batch file that take the file name with particular pattern (say test*.zip ) and assign it to variable. so that I can check/validate whether the file is exists in other location or not.
How to do this ?
I tried below code.. its executing as expected but its executing twice .
@echo on
call :sub "D:\temp\test*.zip"
if exist "D:\temp\Updates\%filename%" (set flag="true") else (set flag="false")
echo %flag%
:sub
set filename=%~nx1
GOTO :EOF
goto :EOFon the line above:subbut it's not going to execute twice. What do you see on the console?