Hi, I don't know if a batch file can do this, but if you run this VBS via a login script, it will look for the next available drive letter, map it to a specific shared folder, run the VBS that requires the mapped drive (hopefully not letter dependant!), and then remove the mapped drive.....
Part of it was taken from here:
http://www.microsoft.com/t
'===============
Set objDictionary = CreateObject("Scripting.Di
Set objNetwork = CreateObject("WScript.Netw
Set objShell = CreateObject("WScript.Shel
strShareToMap = "\\Server\Share\"
strVBSFile = "MyScript.vbs"
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colDisks = objWMIService.ExecQuery("S
For Each objDisk in colDisks
objDictionary.Add objDisk.DeviceID, objDisk.DeviceID
Next
For i = 67 to 90
strDrive = Chr(i) & ":"
If objDictionary.Exists(strDr
Else
'Wscript.Echo strDrive & " is the next available drive letter."
objNetwork.MapNetworkDrive
objShell.Run "wscript """ & strDrive & "\" & strVBSFile & """", 1, True
objNetwork.RemoveNetworkDr
Wscript.Quit
End If
Next
'Wscript.Echo "There are no available drive letters on this computer.
'===============
Regards,
Rob.
Main Topics
Browse All Topics





by: SteveGTRPosted on 2008-02-03 at 12:43:46ID: 20809983
Here's a batch file I have that will dynamically map a drive to a UNC.
Select allOpen in new window