No need to shell out, kix's USE command will do what you want.

use "\\server\share" /user:'$domain\$user' /password:$password

Be sure to set the variables, $domain,
$user, and $password

Bryce