本帖最后由 pcl_test 于 2016-7-9 01:46 编辑
bat+vbs- '&cls&cscript -nologo -e:vbscript "%~f0"<"文本.txt"&pause&exit
- Set fso=CreateObject("Scripting.FileSystemObject")
- Set objDict = WSH.CreateObject("Scripting.Dictionary")
- y = year(Now)
- m = month(Now)
- d = DateAdd("d", -1, DateValue(y&"-"&m&"-1"))
- Do Until CLng(ym) > CLng(y&right("0"&m, 2))
- d = DateAdd("d", 1, d)
- ym = year(d)&right("0"&month(d), 2)
- '1星期日 2星期一 3星期二 4星期三 5星期四 6星期五 7星期六
- If CLng(ym) = CLng(y&right("0"&m, 2)) and Weekday(d) <> 1 Then
- str = str & ym & right("0"&day(d), 2) & Chr(32)
- End If
- Loop
- n = split("15,16", ",") '提取15、16日
- For i=0 To UBound(n)
- objDict.Add CInt(n(i)), 1
- Next
- str = split(RTrim(str), Chr(32))
- Do While WSH.StdIn.AtEndOfStream <> true
- line = WSH.StdIn.ReadLine
- For i=0 To UBound(str)
- If objDict.Exists(CInt(1&right(str(i), 2))-100) Then
- s1 = s1 & str(i) & line & vbCrLf
- Else
- s2 = s2 & str(i) & line & vbCrLf
- End If
- 's3 = s3 & str(i) & line & vbCrLf
- Next
- Loop
- WSH.echo s1
- 'fso.OpenTextFile("提取.txt", 2, true).Write s1
- 'fso.OpenTextFile("其余.txt", 2, true).Write s2
复制代码
|