Usage
I have a large batch files with many useful functions.
I would like to put some of those functions in separate files while at other times I want them in a single containing file so the whole script is a single file.
I want to know, since the CALL command checks the disk for something even in call to labels, does there exist a file which could override an internal label.
Here is how to test this.
in a new folder, first test script labelorfile.bat
@echo off
echo starting test
echo we call the label :mytestfunction
call :mytestfunction
echo this is after "call :mytestfunction" in file labelorfile.bat
echo we call the file mytestfunction.bat
call mytestfunction.bat
echo this is after "call mytestfunction.bat" in file labelorfile.bat
call mytestfunction
echo this is after "call mytestfunction" in file labelorfile.bat
goto :eof
:mytestfunction
echo this is the label :mytestfunction in the labelorfile.bat file
goto :eof
Next file, single line batch file, mytestfunction.bat
echo this is the file mytestfunction.bat
Next file, single line batch file with no extension, mytestfunction
echo this is the file mytestfunction with no extension
I run labelorfile.bat, this is the output
labelorfile.bat
starting test
we call the label :mytestfunction
this is the label :mytestfunction in the labelorfile.bat file
this is after "call :mytestfunction" in file labelorfile.bat
we call the file mytestfunction.bat
this is the file mytestfunction.bat
this is after "call mytestfunction.bat" in file labelorfile.bat
this is the file mytestfunction.bat
this is after "call mytestfunction" in file labelorfile.bat
Conclusion, a file with the name of a label, cannot override a label inside a batch file
Is this correct ?