2011-03-16 77 views

回答

2

我打算停止腳本,如果它映射到錯誤的地方,並使用subst D: C:\folder如果它沒有被映射(這是我想要的),或者只是在繼續從http://msdn.microsoft.com/en-us/library/t9zt39at(v=vs.85).aspx

Set WshNetwork = WScript.CreateObject("WScript.Network") 
Set oDrives = WshNetwork.EnumNetworkDrives 
Set oPrinters = WshNetwork.EnumPrinterConnections 

WScript.Echo "Network drive mappings:" 

For i = 0 to oDrives.Count - 1 Step 2 
    WScript.Echo "Drive " & oDrives.Item(i) & " = " & oDrives.Item(i+1) 
Next 

WScript.Echo 

WScript.Echo "Network printer mappings:" 
For i = 0 to oPrinters.Count - 1 Step 2 
    WScript.Echo "Port " & oPrinters.Item(i) & " = " & oPrinters.Item(i+1) 
Next 
採取