|
FIGURE 1 Continued from Putting It Together This script reads a list of UNC names from a text file and maps a network drive to each name.
Dim WshNetwork Dim fs, listFile Dim nameString, driveNum, driveString Set fs = WScript.CreateObject ("Scripting.FileSystemObject") Set listFile = fs.OpenTextFile("c:\wsh\list.txt") Set WshNetwork = WScript.CreateObject("WScript.Network") Do While listFile.AtEndOfStream <> True nameString = listFile.ReadLine For driveNum = 26 to 5 Step -1 driveString = Chr(driveNum + 64) & ":" On Error Resume Next WshNetwork.MapNetworkDrive driveString, nameString If Err.Number = 0 Then Exit For Next If driveNum <= 5 Then WshShell.Popup("No drive letters available.") End If Loop listFile.Close Published as Operating Systems in the 02/10/98 issue of PC Magazine. |
|
TOP |
Copyright (c) 1998 Ziff-Davis Inc. |