最近头都忙大了,为了一个判定磁盘容量大小并调用bat删除的脚本。具体脚本如下,能够实现判定F盘的可用磁盘容量,且能够自行删除,但是现在的问题是,do循环里面的调用bat脚本停不下来,一直在运行。如要如何修改此vbs脚本。- Set objWMIService = GetObject("winmgmts:")
- Set objLogicalDisk = objWMIService.get("Win32_LogicalDisk.DeviceID='f:'")
-
- Dim a
- Dim s
- Dim m
- Dim c
- Dim w
-
- c = now
- s = objLogicaldisk.Size/(1024*1024*1024)
- s = round(s,2)
- ' WScript.Echo "全部磁盘:"&s& " G "
- m = objLogicalDisk.FreeSpace/(1024*1024*1024)
- m = round(m,2)
- ' WScript.Echo "剩余空间:"&m& " G "
- a = m/s
- a = round(a,2)
-
- Do Until a > 0.6
- Set shell = WScript.CreateObject("WScript.Shell")
- shell.Run"f:\2.bat",0
- Loop
-
- w = (FormatPercent(a,2))
- ' WScript.Echo " 磁盘剩余空间= "&w
-
- call mail()
复制代码
|