I am trying to change the code in order to get two days ago date using the batch file. In this example, I can take today date
for /f "tokens=2 delims==" %%I in ('wmic os get localdatetime /format:list') do set datetime=%%I
set LogDateTime=%datetime:~0,8%_%datetime:~8,6%
However, I don't know how to modify the code to get two days ago data. I am not looking for PowerShell, and not any other solution. We have to use only the batch.
You need to convert the date into a Julian Date to do date math in batch files. Here are two function. One to get the current date and then one to do that date math.