- May
- 120
- 1
As documented under the CALL command, two batch files
---- a.bat ----
echo starting a
b
echo ending a
---- b.bat ----
echo running b
---- ----
the line "ending a" will never be printed, as if you don't use CALL,
the second batch file is chained (goto) not called.
Is there any way of turning off this (frankly, horrible) behaviour? It
makes using batch file wrappers for executables (say, to set some
required environment variables) unworkable, as you can't use the batch
file transparently - you have to use CALL from other batch files. I
recently spent *ages* debugging a problem caused by this :-(
I know it's for CMD compatibility, and I know it can't be off by
default, but is there *any* way round it? If not, could it be added as
an option in v10?
I'd have thought using an executable extension, like "set .bat=call"
would work, but it appears not. Why is that?
Paul.
---- a.bat ----
echo starting a
b
echo ending a
---- b.bat ----
echo running b
---- ----
the line "ending a" will never be printed, as if you don't use CALL,
the second batch file is chained (goto) not called.
Is there any way of turning off this (frankly, horrible) behaviour? It
makes using batch file wrappers for executables (say, to set some
required environment variables) unworkable, as you can't use the batch
file transparently - you have to use CALL from other batch files. I
recently spent *ages* debugging a problem caused by this :-(
I know it's for CMD compatibility, and I know it can't be off by
default, but is there *any* way round it? If not, could it be added as
an option in v10?
I'd have thought using an executable extension, like "set .bat=call"
would work, but it appears not. Why is that?
Paul.