I think you missed my point for issue 1.
With the current phase numbering
A normal command flows as follows:
0 -> 1 -> 2 -> 3 -> skip 4 -> 5 -> usually skip 6 -> 7
Phase 3 only executes if command block in previously executed phase 2 did not start with @
Phase 3 shows the results of phase 2
When a FOR command executes in 7, it kicks off the DO commands, starting with phase 4:
3
^
4 -> 5 -> usually skip 6 -> 7
Phase 4 must explicitly call phase 3 as a subroutine.
Phase 3 only executes if command block in
previously executed (not skipped) phase 4
![Confused :?](./images/smilies/icon_confused.gif)
did not start with @
Phase 3 shows the results of phase 4
Phase 3 then returns to 4 before it flows to 5.
Or, in a linear layout, it flows as
4 -> 3 -> skip 4 -> 5 -> usually skip 6 -> 7
My proposed new phase numbering
A normal command flows as follows:
0 -> 1 -> 2 -> skip 3 -> 4 -> 5 -> usually skip 6 -> 7
Phase 4 only executes if command block in previously executed phase 2 did not start with @
Phase 4 shows the results of phase 2
No matter the order, a normal command always skips FOR expansion, so the order does not matter much
When a FOR command executes in 7, it kicks off the DO commands, starting with phase 3:
3 -> 4 -> 5 - usually skip 6 -> 7
Phase 3 simply flows naturally into phase 4
Phase 4 only executes if command block in previously executed phase 3 did not start with @ - a sensible order
Phase 4 shows the results of phase 3
----------------
Does my proposal make sense now? If starting from scratch, I would definitely use the modified numbering. But for historical reasons, I am reluctant.
Back to Issue 2
Well, my proposed rules were too simple.
I've come up with the following revised rules that seem to work for me on Win 7. I'll test soon on Win 10.
7.1 - Execute internal command - If the command token is quoted, then skip this step. Otherwise, attempt to parse out an internal command and execute.
- The following tests are run to determine if an unquoted command token represents an internal command:
- If the command token exactly matches an internal command, then execute it.
- Else break the command token at the first occurrence of + ( / [ or ]
If the preceding text is an internal command, then execute it
- Else break the original command token at the first occurrence of . \ or :
If the preceding text is not an internal command, then goto 7.2
Else the preceding text may be an internal command. Remember this command.
- Break the original command token at the first occurrence of + ( / [ or ]
If the preceding text is a path to an existing file, then goto 7.2
Else execute the remembered command.
- Just because a command token is parsed as an internal command does not mean that it will execute successfully. Each internal command has its own rules as to what syntax is allowed.
- ...
7.2 - Execute volume change - Else if the command token does not begin with a quote, is exactly two characters long, and the 2nd character is a colon, then change the volume
7.3 - Execute external command - Else try to treat the command as an external command
7.4 - Ignore a label - Ignore the command and all its arguments if the command token begins with :
Rules in 7.2 and 7.3 may prevent a label from reaching this point.
I think the above rules for 7.1 are good,
But they violate a rule that jeb posted at ECHO. FAILS to give text or blank line - Instead use ECHO/
jeb wrote:
These one fails, if files exists like echo*, the * is one of ".[]+'`~"
I agree that ECHO. fails if a file named ECHO exists. Note that the trailing . is removed by the OS
The command fails with an error stating:
'echo.' is not recognized as an internal or external command, operable program or batch file.
This result is consistent with my proposed 7.1 rules - it is not recognized as an internal command, and eventually fails to execute as an external command.
But I cannot reproduce this behavior with ECHO[ ECHO] or ECHO+ on Windows 7.
Update - I have confirmed Win 10 behaves the same as Win 7
If I create a file named ECHO[ and then execute the command ECHO[ then it successfully executes the internal ECHO command and prints a blank line.
The same is true with ] and +
If I could reproduce jeb's result, then it would invalidate my rules.
Did jeb get this wrong
Or does the behavior described by jeb only apply to Win XP
Or ...
Dave Benham