午夜国产狂喷潮在线观看|国产AⅤ精品一区二区久久|中文字幕AV中文字幕|国产看片高清在线

    vbs 定時(shí)刪除功能實(shí)現(xiàn)代碼
    來源:易賢網(wǎng) 閱讀:1278 次 日期:2014-08-12 12:20:01
    溫馨提示:易賢網(wǎng)小編為您整理了“vbs 定時(shí)刪除功能實(shí)現(xiàn)代碼”,方便廣大網(wǎng)友查閱!

    參考代碼一:

    代碼如下:

    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程序就沒有報(bào)錯(cuò)啦。撒花,結(jié)貼~~

    參考代碼二:

    代碼如下:

    Dim dqxs, dqrq, szxs, szfz, dqml, datp

    Dim jclb

    Dim c

    dim d

    '=========================================================

    datp = "F:"

    szxs = "7:00:"

    wjml = datp & "\DVRDat\"

    sykj = 20000000000 '20個(gè)G

    dqml = left(wscript.scriptfullname,instrrev(wscript.scriptfullname,"\")-1)

    jclb = "ServicesManager.exe,PD_Server.exe,SpeedServer.exe,CoreServer.exe,DownloadSVC.exe,ManagerConsole.exe,Gptsvr.exe,HintAMProxy.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 cprlql

    do

        If InStr(time, szxs) <> 0 Then

            if fso.GetDrive(datp).FreeSpace < sykj then call cprlql

        end if

        WScript.Sleep(60*1000)

    loop

    getfso=fso.GetFolder("c:\\windows").DateCreated

    '===========================================================

    Function cprlql

        Dim strline, scml

        WshShell.run "cmd /c dir " & wjml &" /ad /b /tc>c:\dir.log",0

        if fso.FileExists("c:\dir.log") then

            Set objFile = fso.OpenTextFile("c:\dir.log")                

            do until objFile.atendofstream

                strline = objFile.readline

                scml = wjml & strline

                WshShell.run "cmd /c rd /s /q " & scml,0

                for i = 1 to 20

                    if fso.GetDrive(datp).FreeSpace > sykj then exit Function

                    if fso.FolderExists(scml) then

                        WScript.Sleep(1000)

                    else

                        exit for

                    end if

                next

                if fso.GetDrive(datp).FreeSpace > sykj then exit Function

            loop

        end if

    End Function

    更多信息請查看IT技術(shù)專欄

    更多信息請查看腳本欄目
    易賢網(wǎng)手機(jī)網(wǎng)站地址:vbs 定時(shí)刪除功能實(shí)現(xiàn)代碼
    由于各方面情況的不斷調(diào)整與變化,易賢網(wǎng)提供的所有考試信息和咨詢回復(fù)僅供參考,敬請考生以權(quán)威部門公布的正式信息和咨詢?yōu)闇?zhǔn)!

    2025國考·省考課程試聽報(bào)名

    • 報(bào)班類型
    • 姓名
    • 手機(jī)號
    • 驗(yàn)證碼
    關(guān)于我們 | 聯(lián)系我們 | 人才招聘 | 網(wǎng)站聲明 | 網(wǎng)站幫助 | 非正式的簡要咨詢 | 簡要咨詢須知 | 新媒體/短視頻平臺 | 手機(jī)站點(diǎn) | 投訴建議
    工業(yè)和信息化部備案號:滇ICP備2023014141號-1 云南省教育廳備案號:云教ICP備0901021 滇公網(wǎng)安備53010202001879號 人力資源服務(wù)許可證:(云)人服證字(2023)第0102001523號
    云南網(wǎng)警備案專用圖標(biāo)
    聯(lián)系電話:0871-65099533/13759567129 獲取招聘考試信息及咨詢關(guān)注公眾號:hfpxwx
    咨詢QQ:1093837350(9:00—18:00)版權(quán)所有:易賢網(wǎng)
    云南網(wǎng)警報(bào)警專用圖標(biāo)