How to? Lazy evaluation on %@if[]?

#1
I defined a new function, to tell if a given drive is a substituted one or not (following a tip given here a while ago). This function:

function substituted=`%@if["%@left[2,%@truename[%1]]"=="%1",0,1]`

works on ready drives, but fails on non-existing ones (the drives marked with an asterisk are substitutions):

[C:\Users\Miguel\TCC]pwd
NEGRO1 C:\Users\Miguel\TCC\
BLACK2 D:\
NEGRO1 *F:\
NEGRO1 *S:\
NEGRO1 *T:\

[C:\Users\Miguel\TCC]echo %@substituted[C:]
0

[C:\Users\Miguel\TCC]echo %@substituted[T:]
1

[C:\Users\Miguel\TCC]echo %@substituted[X:]
TCC: (Sys) The system cannot find the drive specified.
"X:"



I tried to improve it by prepending a %@ready call, but it didn't work:

[C:\Users\Miguel\TCC]function substituted2=`%@if["%@ready[%1]"=="1" .and. "%@left[2,%@truename[%1]]"=="%1",0,1]`

[C:\Users\Miguel\TCC]echo %@substituted2[C:]
0

[C:\Users\Miguel\TCC]echo %@substituted2[T:]
1

[C:\Users\Miguel\TCC]echo %@substituted2[X:]
TCC: (Sys) The system cannot find the drive specified.
"X:"



I tried to nest to %@if calls instead:

[C:\Users\Miguel\TCC]function substituted3=`%@if["%@ready[%1]"=="1",%@if["%@left[2,%@truename[%1]]"=="%1",0,1],2]`

[C:\Users\Miguel\TCC]echo %@substituted3[C:]
0

[C:\Users\Miguel\TCC]echo %@substituted3[T:]
1

[C:\Users\Miguel\TCC]echo %@substituted3[X:]
TCC: (Sys) The system cannot find the drive specified.
"X:"


... and it doesn't work either.

The help page for @if states "Do not use @IF if evaluating either one of the strings may fail", so it looks I'm out of luck here... or am I?
 
#3
@TRUENAME won't throw an error if you use a backslash. Below, x: does not exist.
Code:
v:\> function issub=`%@if["%@left[3,%@truename[%1\]]"=="%1\",0,1]`

v:\> echo %@issub[c:]
0

v:\> echo %@issub[p:]
1

v:\> echo %@issub[x:]
0
 
#4
Actually, that seems to be unfortunate behavior on the part of @TRUENAME ... not caring if a file or directory exists, but caring if a drive exists.
Code:
v:\> echo %@truename[c:\]
C:\

v:\> echo %@truename[c:]
C:\

v:\> echo %@truename[x:\]
x:\

v:\> echo %@truename[x:]
TCC: (Sys) The system cannot find the drive specified.
 "X:"
 
#5
Actually, that seems to be unfortunate behavior on the part of @TRUENAME ... not caring if a file or directory exists, but caring if a drive exists.
Code:
v:\> echo %@truename[c:\]
C:\

v:\> echo %@truename[c:]
C:\

v:\> echo %@truename[x:\]
x:\

v:\> echo %@truename[x:]
TCC: (Sys) The system cannot find the drive specified.
"X:"
That worked. Thanks.