VBS脚本:监测R盘剩余空间,低于500MB自动扩容
Option Explicit
Dim objFSO, objDrive, intSpaceLeft
Set objFSO = CreateObject('Scripting.FileSystemObject')
Do While True Set objDrive = objFSO.GetDrive('R') intSpaceLeft = objDrive.FreeSpace \ (1024 * 1024)
If intSpaceLeft < 500 Then
Dim objShell, strCommand
Set objShell = CreateObject('WScript.Shell')
strCommand = 'imdisk -e -s 500M -m r:'
objShell.Run strCommand, 0, True
Set objShell = Nothing
End If
WScript.Sleep(5000) '5秒钟监测一次
Loop
Set objFSO = Nothing
原文地址: https://www.cveoy.top/t/topic/njrj 著作权归作者所有。请勿转载和采集!