I am trying to understand this fragment of a batch code, and i cant even imagine what it’s really doing.
Im confused with this 3 lines:
echo @prompt set date=$d$_set time=$t$h$h$h > {a}.bat
%comspec% /e:2048 /c {a}.bat > {b}.bat
for %%v in ({b}.bat del) do call %%v {?}.bat
What do they do?
Really I don’t know where do you find that example because seems a very OLD OLD OLD function for Win9x.
The first echo command prints the desired command in a file named “{a}.bat”
(The printed command sets a date and a hour in the OS)
The second command only executes the CMD (The CMD path is stored in %comspec% variable) with a environment size in bytes (/E:xxxx) passing the printed command inside of {a}.bat like an argument and prints the standard output in a second file ({b}.bat)
The third FOR command uses the second token (del) like a command with the dynamic operator ? wich matches 0 or 1 character so the loop executes a command loop like this:
I Hope this helped you.