vbs 定时删除功能实现代码

这篇文章主要介绍了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(DirPath)
    Set subFSO = targetFSO.SubFolders

    For Each subFolder in SubFSO
If DateDiff("d", subFolder.name, date)>3 Then
    strPath = DirPath&subFolder.name
    objFSO.DeleteFolder(strPath)
    End If
    Next
End Function
Call DeleteLog( )
这样在task Schdeuler里面schedule我的vbs程序就没有报错啦。撒花,结贴~~

以上就是vbs 定时删除功能实现代码的详细内容,更多请关注0133技术站其它相关文章!

赞(0) 打赏
未经允许不得转载:0133技术站首页 » 脚本专栏