This sample interrogates drive mappings.
It should be trivial to delete the mapping you don't want:
Code:
Break ON
$=SetOption("Explicit","ON")
$=SetOption("WrapAtEOL","ON")
Dim $sDriveMapping
For Each $sDriveMapping in udfGetMappedDrives()
$sDriveMapping=Split($sDriveMapping,":")
"Drive '"+$sDriveMapping[0]+":' is mapped to '"+$sDriveMapping[1]+"'"+@CRLF
Next
Exit 0
; Return an array of drive mappings
Function udfGetMappedDrives() ; {{{
Dim $sLine
For Each $sLine in Split(udfPipe("NET USE")[0],@CRLF)
$sLine=Split(udfSqueeze($sLine))
If UBound($sLine)>2
If $sLine[0]="OK" AND Right($sLine[1],1)=":"
Redim Preserve $udfGetMappedDrives[UBound($udfGetMappedDrives)+1]
$udfGetMappedDrives[UBound($udfGetMappedDrives)]=$sLine[1]+$sLine[2]
EndIf
EndIf
Next
EndFunction ; }}}
; Execute a command and return output and error streams {{{
; This code adapted from Chris S. WshPipe() http://www.kixtart.org/ubbthreads/showflat.php?Cat=&Number=8257
Function udfPipe($sCommand, Optional $iTimeout,Optional $iInterval)
Dim $oExec
Redim $udfPipe[2]
If Not $iTimeout $iTimeout=10.0 EndIf
If Not $iInterval $iInterval=0.1 EndIf
$iTimeout=CDbl($iTimeout)
$iInterval=CDbl($iInterval)
$oExec = CreateObject("WScript.Shell").Exec($sCommand)
If Not VarType($oExec)=9 $udfPipe[1]=@SERROR Exit @ERROR EndIf
$udfPipe[0] = $oExec.StdOut.ReadAll
$udfPipe[1] = $oExec.StdErr.ReadAll
; Wait for process to complete to ensure correct exit status is returned
While $oExec.Status=0 And $iTimeout > 0
Sleep $iInterval
$iTimeout=$iTimeout-$iInterval
Loop
If Not ($iTimeOut>0) $udfPipe[1]=$udfPipe[1]+@CRLF+"TIMER EXPIRED" Exit 1460 EndIf
Exit $oExec.ExitCode
EndFunction ;}}}
; Remove repeated characters from string {{{
Function udfSqueeze($sString,Optional $sSqueeze)
If $sSqueeze="" $sSqueeze=" " EndIf
$udfSqueeze=""
While NOT ($sString="")
If NOT ((Left($sString,1)=Right($udfSqueeze,1)) AND InStr($sSqueeze,Left($sString,1)))
$udfSqueeze=$udfSqueeze+Left($sString,1)
EndIf
$sString=SubStr($sString,2)
Loop
Exit 0
EndFunction ; }}}
; vim600: filetype=kix ai ts=4 sw=4 ai fdc=4 fdm=marker