You can use 2 or 3 carets, because only 2 are necessary, but one more doesn't harm in this case as the extra caret escapes the exclamation mark in phase 2, but there it's superfluous.einstein1969 wrote: ↑06 May 2023 02:17Then I wanted to ask you why when there are quotation marks you need two ^ carets. Also why does it work with 3 ^ caret too?. see the example that t3rry did.
Code: Select all
echo Exclam^^!
Now the line looks like echo Exclam^!, the green caret is escaped
In phase 5(delayed expansion) the single caret escapes the exclamation mark
Code: Select all
echo Exclam^^^!
Now the line looks like echo Exclam^!, the green caret and the exclam are escaped
In phase 5(delayed expansion) the single (first) caret escapes the exclamation mark.
I focus to the goal and go backwards.einstein1969 wrote: ↑06 May 2023 02:17But I wanted to ask you a question. What is your method that you use and have you used to discover the various ways to create macros.
My goal was to place the parameters at the end of a macro.
Then I need a blackbox/command/syntax that can get these parameters without any postfix code.
I searched for a solution to
Code: Select all
%blackboxmacro% arg1 arg2
or
%blackboxmacro% arg1 arg2)
Code: Select all
<START OF BLACKBOX>( <BLACK-MAGIC> <END OF BLACKBOX> ... arg1 arg2 )
<START OF BLACKBOX>IF condition ( <BLACK-MAGIC> <END OF BLACKBOX> ... arg1 arg2 )
<START OF BLACKBOX>FOR .. %%X in (something) do ( <BLACK-MAGIC> <END OF BLACKBOX> ... arg1 arg2 )
But a simple parentheses block has the same problem/complexity like a solution without parenthesizes at all.
Code: Select all
<START OF BLACKBOX> <BLACK-MAGIC> <END OF BLACKBOX> ... arg1 arg2
The only good point about FOR-Loops are the fact, that it can execute the block more than once.
But I focused then on the simple form
Code: Select all
<START OF BLACKBOX> <BLACK-MAGIC> <END OF BLACKBOX> ... arg1 arg2
I saw the possible solutions in SET or CALL somebatch.bat, perhaps something like redirection or pipes, but that didn't seem possible.
After the possible last commands of the blackbox were found, the next question occurs, how to work with a value which is set at the end?
This was obviously (really), because there is only one possible command that do things after it do something at the end, and that's a FOR-Loop.
The rest is history.