Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Getting the sever name by letter
Message
De
04/11/1999 17:31:50
 
 
À
04/11/1999 17:18:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
00287179
Message ID:
00287222
Vues:
22
>>I have a win98 network
>>
>>I can I return the server name only by the letter
>>eg.
>> suppose i dont know the servers name.
>>
>>
>> c:\ returns \\computer1
>> d:\ returns \\computer2
>> e:\ returns \\computer3
>>
>> etc.
>>
>>I need to store that to a variable
>>
>
>If you have the Windows Scripting Host installed (which if everyone is running Win98, you do, you can get the information from the Wscript.Network object, which can return a collection of mapped drives and the UNC that they're mapped to via the EnumNetworkDrives method.


Before anyone asks, this is how you use EnumNetworkDrives:
oWshNet = CREATEOBJ('Wscript.Network')
oDriveCollection = oWshNet.EnumNetworkDrives
FOR nI = 0 TO oDriveCollection.Count - 2 STEP 2 && collection is 0 indexed
   ? oDriveCollection.Item[nI] + ' is ' + oDriveCollection.Item[nI+1]
ENDFOR
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform