Annoying CMD.EXE behaviors
Here are the things that separate
cmd.exe from a true scripting language. In cmd.exe:
- You have to know which commands are scripts and which are programs. Honestly,
why did they not fix this when they went to NT?
- The .bat language syntax is highly irregular.
- modes change the meaning of the syntax:
- ENABLEEXTENSIONS
- ENABLEDELAYEDVARIABLEEXPANSION
- etc
- statements in for-statement bodies have different features from
statements at the outer part of a .bat file. Look at the numerous
ways that variable expansion works differently inside a for-statement block
for an example.
- statements within parenthetical blocks have different behavior
than those outside. The shift command is an example.
- The for-statement lets you execute a command in its "in" clause but that
command can't have a pipe in it. Really? -- does no one a microsoft
know how to launch a child process and pipe to it? They must because it works in the rest
of cmd.exe
- Its just buggy. You can write code that works fine one day, and just doesn't
work the next.
- The syntax that does work is very clunky and inconvenient to use:
- Goto. And only Goto for goodness sake!
- When you use a bat file's name, it is treated like a call
But not from another batch file -- its treated like a goto there
- And program's are universally treated like a call.