I have a folder which contains text and excel files. I want the newest or most newly modified excel file . I need to use that file name as an argument to some other program.
I am using below code:
@ECHO OFF
SET FILE="D:\IncrementalCompile\deploy\*.xlsx"
SET cmd="for /F %%i in ("%FILE%") do @echo %%~ni"
FOR /F "tokens=*" %%a in ('%cmd%') do SET arg1=%%a
ECHO "%arg1%"
i am able to do this using Python. But my need is to use a batch program. But this is not giving me the right result. Please help or suggest. Thanks.