Dears,
I 'm facing some difficulties trying to create a batch script to open a specific excel file with variable name.
@ECHO OFF
for /f %%x in ('wmic path win32_localtime get /format:list ^| findstr "="')
do set %%x
set today=%Year%%Month%%Day%
"C:\xxx\xxx\Desktop\FileName" + today-1 + ".xlsx"
The path includes two pieces: Fix piece :"C:\xxx\xxx\Desktop\FileName" Variable piece: yesterday's date in format "YYYYMMDD" without any separation between year,month or day.
thanks for your help!
FORcommand instead ofWMIC.