Hi,
I am using a if condition that will first check if the above command ran successfully if the errorlevel is 0 then execute the condition inside the if condition. My syntax is as follows
if %errorlevel%==0 ( for /f "delims=" %%x in ('dir /b/od C:\Folder ') do set recent=%%xset FILE=%recent%
echo %FILE%
echo "hello world"
) else ( exit 1
)
--------------------------
the for loop is finding the latest file inside the C:\Folder .
The for loop is working fine , if I remove the if condition, but failing when it is inside the if condition.
Kindly help.
Thanks,
Ashis