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.

40 lines
1.1 KiB

  1. '//on error resume next
  2. set objArgs = wscript.Arguments
  3. if objArgs.count < 2 then
  4. wscript.echo "Usage mountpointput volume directory"
  5. wscript.quit(1)
  6. end if
  7. strVolume = Replace(objArgs(0), "\", "\\")
  8. strDirectory = Replace(objArgs(1), "\", "\\")
  9. wscript.echo "Volume: " & strVolume
  10. wscript.echo "Directory: " & strDirectory
  11. '// Get the volume
  12. strQuery = "select * from Win32_Volume where Name = '" & strVolume & "'"
  13. set VolumeSet = GetObject("winmgmts:").ExecQuery(strQuery)
  14. for each obj in VolumeSet
  15. set Volume = obj
  16. exit for
  17. next
  18. '// Get the directory
  19. strQuery = "select * from Win32_Directory where Name = '" & strDirectory & "'"
  20. set objSet = GetObject("winmgmts:").ExecQuery(strQuery)
  21. for each obj in objSet
  22. set Directory = obj
  23. exit for
  24. next
  25. wscript.echo "Volume: " & Volume.Name
  26. wscript.echo "Directory: " & Directory.Name
  27. set objMountPoint = GetObject("winmgmts:Win32_MountPoint").SpawnInstance_
  28. objMountPoint.Volume = Volume.Path_.RelPath
  29. objMountPoint.Directory = Directory.Path_.RelPath
  30. objMountPoint.Put_