The reason you are failing is that the USE command does not take a single string as input. USE requires separate in parameters (Drive, Path, Options (individual)).

See the following code sample: Code:
Function MapDrive($Drive, $Server, $Share)
Dim $Drive, $Server, $Share, $shell
Color c+/n

If $Drive<>"" and $Server<>"" and $Share<>""
$LogText="Connecting $Drive to \\$Server\$Share"
? $LogText
USE $Drive /Delete /Persistent
USE $Drive "\\$Server\$Share"
If @error=0
color g+/n
$x=" - Success"
"$x"
If val($DOS) >= 5
$shell=createobject("shell.application")
$shell.namespace($Drive+"\").self.name=$Share + " on '" + $Server + "'"
$shell = 0
Endif
Else
color r+/n
$x=" - Failed: Error @error"
"$x"
$ErrorState=1
Endif
WriteLog ($LogText + $x)
WriteLog2("%temp%\MapDrive.log",$LogText + $x,1)
Color w+/n
Else
WriteLog ("Function 'MapDrive' called with invalid parameters: '$Drive', '$Server', '$Share'")
Endif
Endfunction

_________________________
Home page: http://www.kixhelp.com/hb/