Checking for presence of a drive letter

Revised Tuesday, August 10, 2010 6:26 AM PDT
By John Mitchell
Article ID 193 (r1253)
Circulation  
PUBLIC


Occasionally you need to know if a mapped network drive has become unavailable, perhaps to send a message to reset the connection, or possibly to abort a command which would fail if the drive is not ready.

EXEC\102 will do that.

Usage

Four switches should follow the \102 :


EXEC\102d123!nextcommand

"D" is the drive to check.

"1" should be either a Y or an N. If it is a "Y", a message is displayed in Notepad that the drive is unavailable.

"2" is also a "Y" or "N", specifying whether the remainder of the command should be aborted. If "Y" (abort), the rest of the batch command (after the exclamation) will not run.

"3" is also a "Y" or "N". If it is a "Y", an ALERT is created and posted if the drive is unavailable.

Example

EXEC\102mYYN!MLOAD1


If drive "M" is not available, a message is displayed in notepad, and the MLOAD1 will not run.

EXEC\102mYN !MLOAD1


If drive "M" is not available, a message is displayed in notepad, and the MLOAD1 will still run.