On Tuesday, 30 November 2021 at 18:24:13 UTC, LangerTom wrote:
> I believe that your command
> SET ZC=1
> is working fine, but checking its result with
> echo === %ZC%
> is going wrong because both lines are placed between round brackets.
Not actually wrong, as it shows that %ZC% is not returning what I want;
and so explains why the next line, if [%ZC%] == [1] ( , is not doing
what I wanted it to do <g>.
> CMD.EXE is reading all code between round brackets at once and is
> resolving variables like %ZC% during code reading. At this time your
> command
> set ZC=1
> did not take place yet.
> To avoid this switch on DELAYEDEXPANSION and note variables like this; !ZC!
>
> The following code should work (not tested):
It does. I copied the whole lot, and it ran. All that I now want is to arrange that the second #### sets ZC to something other than 1, which should be easy (P.S. it was : set /a ZC=1-!ZC!). And I don't want the #### marks to appear in the output as rendered on the screen, but using instead should serve.
I control the input file; I can alter its content in any way that does not adversely affect what appears on the screen when the HTML is rendered. The present part, a pre-processor, just copies the HTML unchanged (I hope), but omitting blocks that I do not want in the output.
> HTH Thomas
>
> By the way: working on html with batch is very hard stuff because html
> code contains many poison characters like <>?*/"&
Understood. No problem here. It is the code which runs next that handles the HTML; it copies the wanted lines, which are those containing the name-strings provided as arguments, and separately lists the contents of the first href=" ... "> in each of those lines for XCOPYing as in my previous thread here. As the input is HTML, if there is a second such link on one of those lines line I will just insert a newline in the input - I think.
Thanks again! |