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