- 帖子
- 1
- 积分
- 103
- 技术
- 0
- 捐助
- 0
- 注册时间
- 2009-7-21
|
批处理如何对循环中的数据做变量延迟
现在有一个批处理文件,打开WORD文件不停的写入文字。
批量打开10个查询后的网页,现在想在WORD里每写入一次文字、每打开一个网页后就暂停几秒或者十几秒以后,再写入文字打开查询后的网页,请问有没有办法在循环中做到时间延迟。谢谢。源代码如下:
@echo off
rem @echo on
cls
set varBeforWord= %date% +%time%
echo Set word=CreateObject("Word.Application")>%temp%_tmp.vbs
echo word.Visible=True >>%temp%_tmp.vbs
echo word.Documents.Add>>%temp%_tmp.vbs
for /l %%i in (1,1,10000) do echo word.Selection.TypeText("Hello VeryBat World!")>>%temp%_tmp.vbs
set varAfterWord= %date% +%time%
echo word.ActiveDocument.SaveAs("c:\Test.doc") >>%temp%_tmp.vbs
rem echo word.Quit(False)>>%temp%_tmp.vbs
rem echo Set word=Nothing >>%temp%_tmp.vbs
set varSaveWord= %date% +%time%
set keywords=师傅你好
for /l %%i in (1,1,10) do start iexplore http://www.baidu.com/s?wd=%keywords%
set varAfterOpenIE= %date% +%time%
@echo on
echo 1--Begin: %varBeforWord%
echo 2--After Write Word: %varAfterWord%
echo 3--After close Word: %varAfterWord%
echo 4:--After Open IE: %varAfterOpenIE%
WScript.exe %temp%_tmp.vbs
del %temp%_tmp.vbs |
|