标题: [问题求助] 求助vbs循环执行指定秒数后停止工作的代码没有正常循环是什么原因 [打印本页]
作者: hnldwhm52 时间: 2015-1-3 10:45 标题: 求助vbs循环执行指定秒数后停止工作的代码没有正常循环是什么原因
本帖最后由 pcl_test 于 2016-9-13 20:10 编辑
老师节日好!!
以下123.VBS 如下,只运行了一次循环体就停止工作,而不是循环执行160秒后停止工作,不知错在何处请指教?
谢谢!!
123.VBS:- Dim strPrgpth
- strPrgpth = """e:\工具\武侠.exe"""
- Set wshshell = CreateObject("wscript.shell")
- Set oexec = wshshell.exec(strPrgpth)
-
- t=timer
- do while timer-t<160
-
- wscript.sleep 1000
- wshshell.Sendkeys "{ENTER}"
- wscript.sleep 30000
- wshshell.Sendkeys "{ENTER}"
- process.Terminate
- loop
复制代码
作者: yu2n 时间: 2015-1-3 10:58
- Dim strPrgpth
- strPrgpth = """e:\工具\武侠.exe"""
- Set wshshell = CreateObject("wscript.shell")
- Set oexec = wshshell.exec(strPrgpth)
-
- t=timer
- do while timer-t<160
- wscript.sleep 1000
- wshshell.Sendkeys "{ENTER}"
- wscript.sleep 30000
- wshshell.Sendkeys "{ENTER}"
- loop
- process.Terminate
复制代码
作者: hnldwhm52 时间: 2015-1-3 16:14
回复 2# yu2n
谢谢yu2n老师解答!!我用了还是不行,还请费心!
作者: yu2n 时间: 2015-1-3 20:34
- Dim strPrgpth
- strPrgpth = """%WinDir%\NOTEPAD.EXE"""
- Set wshshell = CreateObject("wscript.shell")
- Set oexec = wshshell.exec(strPrgpth)
-
- t = Timer
- Do While Timer - t < 5
- wscript.sleep 1000
- wshshell.Sendkeys "{ENTER}"
- wscript.sleep 3000
- wshshell.Sendkeys "{ENTER}"
- loop
- oexec.Terminate
复制代码
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |