Network 对象使您能够访问有关网络的信息。下面的脚本将演示如何映射网络驱动器。首先,脚本将创建一个 Network 对象。接着,MapNetworkDrive 方法(Network 对象的一个方法)执行映射操作。MapNetworkDrive 方法采用五个参数:
// JScript。 var net; net = new ActiveXObject("WScript.Network"); net.MapNetworkDrive
("I:","\\\\computer2\\public","True","jdoe","jdoepassword"); ' VBScript。 Dim net Set net = CreateObject("WScript.Network") net.MapNetworkDrive
"I:","\\computer2\public","True","jdoe","jdoepassword"