Jump to content

Test for the existence of a drive?


Recommended Posts

Guest Sid Elbow
Posted

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?

  • Replies 2
  • Created
  • Last Reply

Popular Days

Guest Pegasus \(MVP\)
Posted

Re: Test for the existence of a drive?

 

 

"Sid Elbow" <here@there.com> wrote in message

news:3264e$4763f6b1$4c0aada1$15694@TEKSAVVY.COM...

>

> 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

Guest Sid Elbow
Posted

Re: Test for the existence of a drive?

 

Pegasus (MVP) wrote:

> 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!


×
×
  • Create New...