- set fso = CreateObject("Scripting.FileSystemObject")
- yourMon=DateValue(inputbox("下面是当前年月","请输入年月",DatePart("yyyy",Date)&"-"&DatePart("m",Date)))
- do while month(yourMon+i)=month(yourMon)
- strDate = year(yourMon+i) & String(1 and len(month(yourMon+i)), "0") & month(yourMon+i) & String(1 and len(day(yourMon+i)), "0") & day(yourMon+i)
- fso.OpenTextFile("b.txt",8,true).WriteLine myReplace(strDate & "0755")
- i=i+1
- loop
-
- function myReplace(str)
- Set theFile = fso.OpenTextFile("a.txt")
- Do While theFile.AtEndOfStream <> True
- retstring = retstring & Replace(theFile.ReadLine, "000", str, 1,1,1) & "001" & vbCrLf
- Loop
- theFile.Close
- myReplace = retstring
- End Function
复制代码 晕 vbs返回的时间与cmd不同,对1位数不能自动在前面补0 |