Recently I tried to Make a Batch Code to Download Radio Archive in a Schedule, But there was some problems I'm interested to understand better I needed to get Yesterday date It was too complex to make it in cmd, I tried VB
File:yester.vbs
d=date()-1
wscript.echo year(d)*10000+month(d)*100+day(d)
output would be 20190814 for today, It's the then I tried to use it in a bat file and add link to IDM
CD /D "C:\Program Files (x86)\Internet Download Manager\"
for /f %%a in ('cscript //nologo yester.vbs') do set yesterday=%%a
set DT=%yesterday%
set YY=%DT:~0,4%
set MM=%DT:~4,2%
set DD=%DT:~6,2%
IDMan.exe /a /d rtmp://%YY%%MM%%DD% /f %YY%%MM%%DD%.FLV
Stiil the problem is the code only work when it's on the same folder as IDM and VB Code File or else the Yesterday variable would change to "Input" In order to fix this problem I must add this Code in Beggining of Batch file. But it work without a problem in command prompt
Setlocal EnableDelayedExpansion
then the bat file will work on any path I'm not a proffasional, still interested to know more about rules of using script in batch files. Thanks