EnumNetworkDrives Method

 

Description

 

Returns the current network drive mapping information.

 

PowerBASIC Syntax

 

METHOD NewEnumNetworkDrives () AS IWshCollection

 

Remarks

 

The EnumNetworkDrives method returns a collection. This collection is an array that associates pairs of items — network drive local names and their associated UNC names. Even-numbered items in the collection represent local names of logical drives. Odd-numbered items represent the associated UNC share names. The first item in the collection is at index zero (0).

 

Example [PowerBASIC]

 

#INCLUDE "WSHOM.INC"

 

DIM pWshNetwork AS IWshNetwork

DIM pDrives AS IWshCollection

DIM i AS LONG

DIM v1 AS VARIANT

DIM v2 AS VARIANT

 

pWshNetwork = NEWCOM "WScript.Network"

pDrives = pWshNetwork.EnumNetworkDrives

FOR i = 0 TO pDrives.Count - 1 STEP 2

   v1 = pDrives.Item(i)

   v2 = pDrives.Item(i + 1)

   STDOUT "Drive " & VARIANT$(v1) & " = " & VARIANT$(v2)

NEXT

 

Valid XHTML 1.0 Transitional