I am trying to create an environment variable for yesterday\'s date. It MUST be in the format of MM/DD/YYYY.
For code I currently have:
What you should do is use a method which is not based upon user/locale/PC settings. Commonly wmic is used for that, but it isn't the fastest method and would still require performing some math.
You could use vbscript embedded directly into your batch-file:
@Echo Off
For /F %%# In ('PowerShell -NoP "(Get-Date).AddDays(-1).ToString('MM/dd/yyy')"'
)Do Set "YesterDate=%%#"
Echo(%YesterDate%
Pause