Welcome!

By registering with us, you'll be able to discuss, share and private message with other members of our community.

SignUp Now!

Check readiness of a network mapped drive

May
572
4
@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.
 
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.
 
Back
Top