收藏 分享(赏)

vbs 定时删除功能实现代码.doc

上传人:kuailexingkong 文档编号:1181806 上传时间:2018-06-17 格式:DOC 页数:2 大小:17.50KB
下载 相关 举报
vbs 定时删除功能实现代码.doc_第1页
第1页 / 共2页
vbs 定时删除功能实现代码.doc_第2页
第2页 / 共2页
亲,该文档总共2页,全部预览完了,如果喜欢就下载吧!
资源描述

1、 vbs 定时删除功能实现代码参考代码一:代码如下:Function DeleteLog( )Dim objFSO, objFolder, strPath, targetFSO, subFSO, DirPath DirPath = createobject(“Scripting.FileSystemObject“).GetFile(Wscript.ScriptFullName).ParentFolder.Path“Log“Set objFSO = CreateObject(“Scripting.FileSystemObject“)Set targetFSO = objFSO.GetFolder

2、(DirPath)Set subFSO = targetFSO.SubFolders For Each subFolder in SubFSOIf DateDiff(“d“, subFolder.name, date)3 ThenstrPath = DirPathsubFolder.nameobjFSO.DeleteFolder(strPath)End IfNextEnd Function Call DeleteLog( )这样在 task Schdeuler 里面 schedule 我的 vbs 程序就没有报错啦。撒花,结贴 参考代码二:代码如下:Dim dqxs, dqrq, szxs,

3、szfz, dqml, datpDim jclbDim cdim d=datp = “F:“szxs = “7:00:“wjml = datp “DVRDat“sykj = 20000000000 20 个 Gdqml = left(wscript.scriptfullname,instrrev(wscript.scriptfullname,“)-1)jclb = “ServicesManager.exe,PD_Server.exe,SpeedServer.exe,CoreServer.exe,DownloadSVC.exe,ManagerConsole.exe,Gptsvr.exe,Hint

4、AMProxy.exe,FileServer.exe,CleanDisk.exe,GetNetData.exe,SGUClient.exe,SGUServer.exe,“set WshShell = WScript.CreateObject(“WScript.Shell“)Set fso = Wscript.CreateObject(“Scripting.FileSystemObject“)=if fso.GetDrive(datp).FreeSpace sykj then call cprlqldoIf InStr(time, szxs) 0 Thenif fso.GetDrive(datp

5、).FreeSpace sykj then call cprlqlend ifWScript.Sleep(60*1000)loop getfso=fso.GetFolder(“c:windows“).DateCreated=Function cprlqlDim strline, scmlWshShell.run “cmd /c dir “ wjml “ /ad /b /tcc:dir.log“,0if fso.FileExists(“c:dir.log“) thenSet objFile = fso.OpenTextFile(“c:dir.log“) do until objFile.aten

6、dofstreamstrline = objFile.readlinescml = wjml strlineWshShell.run “cmd /c rd /s /q “ scml,0for i = 1 to 20if fso.GetDrive(datp).FreeSpace sykj then exit Functionif fso.FolderExists(scml) thenWScript.Sleep(1000)elseexit forend ifnextif fso.GetDrive(datp).FreeSpace sykj then exit Functionloopend ifEnd Function

展开阅读全文
相关资源
猜你喜欢
相关搜索

当前位置:首页 > 企业管理 > 经营企划

本站链接:文库   一言   我酷   合作


客服QQ:2549714901微博号:道客多多官方知乎号:道客多多

经营许可证编号: 粤ICP备2021046453号世界地图

道客多多©版权所有2020-2025营业执照举报