I am trying to create a batch file to find the newest file in a directory. I am using the following commands in the batch:
call cd\
call d:
call cd "D:\OMS\Outbound\"
call for /f "tokens=* delims= " %%G in ('dir /b /od') do set newest=%%G
call pause
I am getting the error G was unexpected at this time.
Also I would like to ftp the newest file and will have to append "local:D:\OMS\Outbound\" before %%G in the following manner newest=local:D:\OMS\Outbound\%G.
The code works just fine when run from command prompt but the batch file is not working.
calls in every line.