By registering with us, you'll be able to discuss, share and private message with other members of our community.
SignUp Now!%_calldepth
variable and a %@callstack[n]
function to make this info available. Whether there would be much I don't think the current version exposes the call stack to the user.
I imagine it would be possible to add, say, a%_calldepth
variable and a%@callstack[n]
function to make this info available. Whether there would be muchcalldemand for such a feature, I have no idea.
call errorlevel.bat
Wouldn't it be possible to add %_batchname to your call?
I don't think the current version exposes the call stack to the user.
I imagine it would be possible to add, say, a%_calldepth
variable and a%@callstack[n]
function to make this info available. Whether there would be muchcalldemand for such a feature, I have no idea.
v:\> alias call `set _callingfile=%@full[%%0] & *call`
v:\> type b1.btm
call b3.btm
v:\> type b2.btm
call b3.btm
v:\> type b3.btm
echo I am %@full[%0] and I was called by %_callingfile
v:\> b1.btm
I am V:\b3.btm and I was called by V:\b1.btm
v:\> b2.btm
I am V:\b3.btm and I was called by V:\b2.btm
v:\> type b1.btm
call b2.btm
v:\> type b2.btm
echo I am %@full[%0] and I was called by %_callingfile
call b3.btm
v:\> type b3.btm
echo I am %@full[%0] and I was called by %_callingfile
v:\> b1.btm
I am V:\b2.btm and I was called by V:\b1.btm
I am V:\b3.btm and I was called by V:\b2.btm
That depends on SETLOCAL and I didn't like that. This alias works better but I'm not sure it's perfect.Is _CALLINGFILE restored when returning from a nested batch file?
alias call `setlocal & set _callingfile=%@full[%%0] & *call %$ & endlocal`
call=`set _callingerrorlevel=%_? %+ set _callingfile=%@full[%%0] %+ *call %$`
I have no clue what you're doing but %? might be more appropriate than %_?.
And that snippet about variables is simply wrong (where did it come from?).
%_? and %? are not the same.
%_? is for INTERNAL commands
%? is for EXTERNAL things
%_? is for INTERNAL commands
%? is for EXTERNAL things
Nobody has ever asked previously for the parent batch file name.