curl - add variable in url batch programming

I have a batch file where I have a variable which prints date in YYYYMMDD - 20160403

for /F "usebackq tokens=1,2 delims==" %%i in (`wmic os get LocalDateTime /VALUE 2^>NUL`) do if '.%%i.'=='.LocalDateTime.' set ldt=%%j
set ldt=%ldt:~0,4%%ldt:~4,2%%ldt:~6,2%
echo Local date is %ldt%

then I am downloading a file which has the date a the end of the url

curl "http://www.example.com/cgi-bin/abc.xyz/%ldt%.txt" -o file-name-%ldt%.txt

where %ldt% has the date for eg: 20160403

but now I am not able to print the date. Any suggesstions ?

Answers


%date% is an internal windows variable. It is not wise to overwrite it. Use another variable name (for example %myDate%).

By the way: you can restore the original windows variable by (no joke) deleting it: set "date="


Need Your Help

Is there some literature on this type of programming?

design-patterns oop functional-programming

In college I took on a class on modern physics, in which we learned about special relativity. I was completely blown away by how different frames of reference could actually observe physical prope...

How do I use a PictureBox as a Button

c# .net winforms button picturebox

I'd like to create a roulette game, and I've made a PictureBox with an image of a roulette table.