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

对于内存当硬盘一文的扩展


2007-10-05 03:56:29
 标签:硬盘 内存   [推送到技术圈]

本文是 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&regkey&"\*.*" &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
'****************功能函数模块******************
 
如果有更好的想法 请您斧正




    文章评论
 
2007-10-05 12:15:43
如果使用Maxthon,那么缓存是不是可以自动清理了呢?
如果IE缓存保存时间设置为“0”天,或者设置成自动检查更新,或者设置较大的缓存空间的话,有什么不一样吗?
一般IE缓存的使用量会很大吗?

2007-10-05 14:19:02
请看第这篇文章的姊妹篇
http://foxhack.blog.51cto.com/96963/45043

 

发表评论

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