[新手上路]批处理新手入门导读[视频教程]批处理基础视频教程[视频教程]VBS基础视频教程[批处理精品]批处理版照片整理器
[批处理精品]纯批处理备份&还原驱动[批处理精品]CMD命令50条不能说的秘密[在线下载]第三方命令行工具[在线帮助]VBScript / JScript 在线参考
返回列表 发帖
占位,晚上回来给你解决
---学无止境---

TOP

不好意思,今晚回来有点晚
  1. '//保存我为new.vbs,然后运行即可
  2. Dim intDays,intLines,strLast,strOut
  3. Dim FirstDate,i,outDate,newDate,f
  4. strLast="XXX" '//此处为日期后面的文本后面
  5. FirstDay=InputBox("请输入第一天,格式为 年-月-日 如"&vbCrLf&"2011-1-1:")
  6. intDays=InputBox("请输入时间间隔(天):")
  7. intLines=InputBox("请输入行数:")
  8. intDays=intDays+1
  9. strOut=FormatDate(FirstDay) & strLast
  10. newDate=DateAdd("d",intDays,FirstDay)
  11. For i=1 To intLines-1
  12. strOut=strOut & vbCrLf & FormatDate(newDate) & strLast
  13. newDate=DateAdd("d",intDays,newDate)
  14. Next
  15. Set f=CreateObject("scripting.filesystemobject").CreateTextFile("1.txt",True)
  16. f.Write strOut
  17. f.Close
  18. MsgBox "保存在当前目录下1.TXT"
  19. Set f=Nothing
  20. '//定义函数判断日期格式
  21. Function FormatDate(strDate)
  22. Dim strYear,strMonth,strDay
  23. strYear=DatePart("yyyy",strDate)
  24. strMonth=FormatNum(DatePart("m",strDate))
  25. strDay=FormatNum(DatePart("d",strDate))
  26. FormatDate=strYear & strMonth & strDay
  27. End Function
  28. '//定义过程判断日期格式2
  29. Function FormatNum(intNum)
  30. If Len(intNum)=1 Then
  31. FormatNum="0" & intNum
  32. Else
  33. FormatNum=intNum
  34. End If
  35. End Function
复制代码
1

评分人数

---学无止境---

TOP

返回列表