?? p700_wshnetwork_example.js
字號:
var objNet, collNetDrive, collNetPrint;
objNet = WScript.CreateObject("WScript.Network");
WScript.Echo
(
"Computer Name:\t" + objNet.ComputerName + "\n" +
"Current User:\t" + objNet.UserName + "\n" +
"User Domain:\t" + objNet.UserDomain
);
objNet.MapNetworkDrive("Z:", "\\\\Server\\Share");
collNetDrive = objNet.EnumNetworkDrives();
// echo all networked drives
for (var i = 0; i < collNetDrive.Count(); i++)
{
WScript.Echo("\n" + collNetDrive.Item(i));
}
objNet.RemoveNetworkDrive("Z:");
objNet.AddWindowsPrinterConnection("\\\\PrintServer\\Share");
objNet.SetDefaultPrinter("\\\\PrintServer\\Share");
collNetPrint = objNet.EnumPrinterConnections();
// echo all networked printers
for (var j = 0; j < collNetPrint.Count(); j++)
{
WScript.Echo("\n" + collNetPrint.Item(j));
}
objNet.RemovePrinterConnection("LPT1:");
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -