参考代码一:
复制代码 代码如下:
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程序就没有报错啦。撒花,结贴~~
参考代码二:
复制代码 代码如下:
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
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
免责声明:本站资源来自互联网收集,仅供用于学习和交流,请遵循相关法律法规,本站一切资源不代表本站立场,如有侵权、后门、不妥请联系本站删除!
更新日志
- RonaldBrautigam,PeterMasseursandConcertgebouwOrchestraAmsterdam-ShostakovichTheJazz
- 筷子兄弟《老男孩》[WAV+CUE][899M]
- 陈曦《寂寞在唱歌HQCD》2023头版限量编号[WAV+CUE][1G]
- 张惠妹《阿密特》NEW XRCD[WAV+CUE][455M]
- 邓伟标《西游记之悟空》24K金碟限量编号首版[低速原抓WAV+CUE]
- 群星《2024好听新歌40》AI调整音效【WAV分轨】
- 张梦弘《大城小爱HQ》头版限量编号[低速原抓WAV+CUE]
- 张敬轩《MY 1ST COLLECTION》2CD[WAV+CUE][1.7G]
- 张玮伽《夜归人HQⅡ》2024头版限量编号[WAV+CUE][523M]
- 证声音乐图书馆《夏至 爵士境地》[320K/MP3][70.37MB]
- 孙露《同名专辑》限量1:1母盘直刻[低速原抓WAV+CUE]
- 【宝丽金唱片】群星《鼓舞飞扬》WAV+CUE
- 莫扎特弗雷德沃夏克肖斯塔科维奇《钢琴五重奏》(DG24-96)FLAC
- 证声音乐图书馆《夏至 爵士境地》[FLAC/分轨][360.16MB]
- 证声音乐图书馆《日落琴声 x 弦乐》[320K/MP3][71.2MB]