Check readiness of a network mapped drive

May 29, 2008
558
4
Groton, CT
@READY[x:] is very slow to return 0 when the x drive is not reachable. NET USE is very fast, though, so here's my solution:
Code:
FUNCTION NETREADY=`%@if["%@word[0,%@execstr[net use |! ffind /k /m /t%@left[1,%1]:]]" eq "OK",1,0]`
Unfortunately, this will always return 0 for a drive that is not a network drive.
 
May 29, 2008
558
4
Groton, CT
And will also won't work for network drives mapped through SUBST (not present in NET USE).
You could incorporate @TRUENAME into this function. Here's what I came up with
Code:
%@if["%@word[0,%@execstr[net use |! ffind /k /m /t%@left[1,%@truename[%@left[1,%1]:]]:]]" eq "OK",1,0]
Unfortunately, that does not work for a drive which is not SUBSTituted.
Since I rarely use SUBST, I didn't think of it, and I'm sticking with what I came up with. If you use SUBST for network drives, you could probably make a new function, say @SUBSTREADY to do the job.
 
Thread starter Similar threads Forum Replies Date
mikea T&T - Functions 0
Similar threads
Checking for a wildcard