对于内存当硬盘一文的扩展
本文是 http://foxhack.blog.51cto.com/96963/45043 的后继文章请阅读后往下看
由于IE的缓存不会自动清理 所以当虚拟出来的内存满了后 就回出现网页浏览速度变慢甚至发生变形的问题 所以针对这种情况用脚本写了个小的程序 用来随时监控虚拟内存的空间当小于某个阀值的时候就自动清理 腾出多余的空间(顺便练习一下 很久没用脚本写程序了)
*******************************************
' ----- ExeScript Options Begin -----
' ScriptType: window,activescript ' DestDirectory: current ' Icon: H:\脚本调试与编辑\ICOfile\dragon.ico ' OutputFile: C:\Documents and Settings\Administrator\桌面\cleartemp.exe ' ----- ExeScript Options End ----- 'email:hh19860709@126.com qq:278563291 Dim fso, WriteFile,asccode
Set fso = CreateObject("Scripting.FileSystemObject") Set WriteFile = fso.CreateTextFile("c:\remove.bat",True) asccode=chr(34) WriteFile.Write ("del /f /s /q "&asccode®key&"\*.*" &asccode) WriteFile.Close() Set WshShell = WScript.CreateObject("WScript.Shell") do dim a if diskspace<5 then a=WshShell.run ("c:\remove.bat",0,true) else WScript.Sleep 1000*60*2 end if loop '****************功能函数模块****************** function regkey Dim ReadRegKey, TempKey Set ReadRegKey= WScript.CreateObject("WScript.Shell") TempKey=ReadRegKey.RegRead("HKEY_CURRENT_USER\Software\Microsoft\Windows\CurrentVersion\Explorer\User Shell Folders\cache") regkey=TempKey end function '****************功能函数模块****************** function diskspace dim fso ,space,s Set fso = CreateObject("Scripting.FileSystemObject") Set d = fso.GetDrive(fso.GetDriveName(regkey)) s = FormatNumber(d.FreeSpace/(1024*1024), 0) diskspace=s end function '****************功能函数模块****************** 如果有更好的想法 请您斧正 本文出自 51CTO.COM技术博客 |


foxhack
博客统计信息
热门文章
最新评论
友情链接