MapNetworkDrive variations
This does exactly the same job as
Example 1. What I want to demonstrate here is that there are a multitude
of ways of ing. By approaching the problem for a different angle
you get perspective on what Microsoft"s VB is all about.
Notes
1. This example uses lower case for
strDriveLetter. X or x would work equally well.
2. Instead of declaring the optional
arguments in advance, I just typed them in where needed.
" MNDArguments2.vbs
" VB to map a network drive with all 5 arguments.
" Author Guy Thomas http://computerperformance.co.uk/
" Version 2.2 - April 24th 2005
" -----------------------------------------------------------------"
Option Explicit
Dim objNetwork
Dim strDriveLetter, strRemotePath, strUser, strPassword, strProfile
" Values of variables set
strDriveLetter = "X:"
strRemotePath = "\\alan\home"
" This section creates a network . (objNetwork)
" Then to apply the MapNetworkDrive method. Result X: drive
Set objNetwork = Create("W.Network")
objNetwork.MapNetworkDrive strDriveLetter, strRemotePath, false, gt, pass
" Extra code just to add a message box
W.Echo " Launch Windows Explorer, check: "& strDriveLetter
W.Quit
" End of Example VB.