注册 | 登录 忘记密码? 51cto首页 | 博客 | 论坛 | 招聘
热点文章 负载均衡技术沙龙问答汇集
 帮助

exec 列磁盘信息


2007-07-03 16:20:59
 标签:exec 列磁盘   [推送到技术圈]

Option Explicit
Dim action,oShell,oExec,strOut,MyArray,f1,oExec2
Set oShell=WScript.CreateObject("WScript.shell")
use
action=lcase(trim(Wscript.Arguments(0)))
select case action
case "drivetype"
   list
Case "volumeinfo"
list
Case "ntfsinfo"
list
Case "statistics"
list
case else
   WScript.quit
end select
Function str()
Set oExec = oShell.Exec("fsutil.exe fsinfo drives")
      Do While Not oExec.StdOut.AtEndOfStream
      strOut = strOut & oExec.StdOut.Readall
      strout = Replace(strout,Chr(0)," ")
      strout=Replace(strout,vbCrLf,"")
      strout=Replace(strout,Chr(10),"")
      strout=Replace(strout,Chr(13),"")
      strout=Replace(strout,"驱动器:","")
      strOut=Trim(strout)
      Loop
      str=strout
End function     
  
Function list()
   MyArray = Split(str, " ", -1, 1)
   For Each f1 in MyArray
   
    Set oExec2 = oShell.Exec("fsutil.exe fsinfo "& Wscript.Arguments(0) &" "& f1)
    WScript.Echo f1&vbcrlf&oExec2.StdOut.ReadAll

   Next
End function
Function use()
If WScript.Arguments.Count <>1   Then
WScript.Echo WScript.FullName &"drivetype | ntfsinfo | statistics"
WScript.Quit
End if
End function


上一篇 用VBS模拟NC发包  下一篇 FSO 列磁盘信息



    文章评论
 
 

发表评论

昵   称:
验证码:  点击图片可刷新验证码  博客过2级,无需填写验证码
内   容: