Test for the existence of a drive?

S

Sid Elbow

I have a Netgear SAN device on my LAN (like a NAS device it connects to
the LAN but unlike the NAS, it has little intelligence of its own and
does not show up as a network resource. Instead, a driver is installed
on each workstation that makes the SAN appear as a virtual local drive).

Because of the need to install the driver which then has to attach the
drive, the drive is not available for a short time after booting. This
gives me some difficulty because I need to set up a drive mapping to a
folder on the virtual drive that is created but when I do, it fails
after a reboot because the drive does not, initially, exist.

Is there a way that I can test, in a .BAT file, whether the drive exists
and loop until it does? Then I could create the drive-mapping with SUBST
as was discussed here recently.

Failing that, is there a way to simply introduce a time delay of maybe
up to a minute in a .BAT file?
 
P

Pegasus \(MVP\)

Sid Elbow said:
I have a Netgear SAN device on my LAN (like a NAS device it connects to
the LAN but unlike the NAS, it has little intelligence of its own and does
not show up as a network resource. Instead, a driver is installed on each
workstation that makes the SAN appear as a virtual local drive).

Because of the need to install the driver which then has to attach the
drive, the drive is not available for a short time after booting. This
gives me some difficulty because I need to set up a drive mapping to a
folder on the virtual drive that is created but when I do, it fails after
a reboot because the drive does not, initially, exist.

Is there a way that I can test, in a .BAT file, whether the drive exists
and loop until it does? Then I could create the drive-mapping with SUBST
as was discussed here recently.

Failing that, is there a way to simply introduce a time delay of maybe up
to a minute in a .BAT file?

To create a delay of 60 seconds:
ping localhost -n 61 > nul

To test for the existence of a drive:

@echo off
:again
ping localhost -n 31 > nul
dir x:\ 1>nul 2>nul
if ErrorLevel 1 goto again

Depending on how your SAN device appears when it becomes
available, the above test may not work. If so then you might
have to explore the output of this command:

mountvol
 
S

Sid Elbow

Pegasus said:
To test for the existence of a drive:

@echo off
:again
ping localhost -n 31 > nul
dir x:\ 1>nul 2>nul
if ErrorLevel 1 goto again

Depending on how your SAN device appears when it becomes
available, the above test may not work ...

Seems to work fine. Thanks a bunch!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top