Leaked source code of windows server 2003
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

49 lines
854 B

  1. '
  2. ' test2.vbs
  3. '
  4. ' device lists
  5. '
  6. Dim WshSHell
  7. Dim DevCon
  8. Dim AllDevs
  9. Dim DelDev
  10. Dim Dev
  11. set WshShell = WScript.CreateObject("WScript.Shell")
  12. set DevCon = WScript.CreateObject("DevCon.DeviceConsole")
  13. set AllDevs = DevCon.AllDevices()
  14. Count = AllDevs.Count
  15. Wscript.Echo "Enum, Count="+CStr(Count)
  16. FOR EACH Dev In AllDevs
  17. WScript.Echo Dev
  18. NEXT
  19. DelDev = AllDevs(2)
  20. Wscript.Echo "Remove 2 - "+DelDev
  21. AllDevs.Remove 2
  22. Count = AllDevs.Count
  23. Wscript.Echo "Iterate 1.."+CStr(Count)
  24. For i = 1 To Count
  25. Dev = AllDevs(i)
  26. WScript.Echo Dev
  27. NEXT
  28. AllDevs.Add DelDev
  29. AllDevs.Add Dev
  30. Count = AllDevs.Count
  31. Wscript.Echo "Count="+CStr(Count)
  32. For i = 1 To Count
  33. WScript.Echo AllDevs(i)
  34. NEXT
  35. Set WshShell = nothing
  36. Set DevCon = nothing
  37. Set AllDevs = nothing
  38. Set Dev = nothing
  39. Set DelDev = nothing