我编写了以下javascript,将其放在我的启动文件夹中,以解决映射驱动器的一些问题。不幸的是,它的副作用是以H:\作为当前目录启动命令提示。我怎样才能避开这件事?
var objNetwork = WScript.CreateObject("WScript.Network");
/* Remove Network Drives */
try {
objNetwork.RemoveNetworkDrive("H:", true, true);
} catch (e) {}
try {
objNetwork.RemoveNetworkDrive("Y:", true, true);
} catch (e) {}
try {
objNetwork.RemoveNetworkDrive("Z:", true, true);
} catch (e) {}
/* Recreate Network Drives */
objNetwork.MapNetworkDrive ("H:", "\\\\server1\\home", false);
objNetwork.MapNetworkDrive ("Y:", "\\\\server2\\source", false, "user", "pass");
objNetwork.MapNetworkDrive ("Z:", "\\\\server3\\source", false, "user", "pass");