windows下的计时等待
因为程序的需要,所以之有一个通过时间等待定期杀掉进程的程序。在linux下可以通过sleep命令很容易的实现,而在windows下却没有这么好的命令,不过windows为我们提供了vbs脚本功能,所以可以通过下面的例子,查看其功能的强大:
@echo off
:loop
cls
taskkill /f /im 360se.exe
echo wscript.sleep 1000*120 >sleep.vbs
sleep.vbs
del sleep.vbs
goto loop
echo那句表示等待1000*120毫秒,也就是2分钟。当然也可以直接写10000(10秒), 两者的作用是一样的。
通过一个loop循环,定期是2分钟查杀一下360浏览器的进程。
而网上更有甚者,通过vbs脚本的简单调用写女友写了封示爱信,就是佩服那哥们啊,这里我也把代码贴出来博大家一晒
set fso=createobject(“scripting.filesystemobject”)
set ws=wscript.createobject(“wscript.shell”)
fso.createtextfile(“love.txt”)
ws.run(“love.txt”)
wscript.sleep 500
ws.sendkeys(“S”)
wscript.sleep 500
ws.sendkeys(“o”)
wscript.sleep 500
ws.sendkeys(“r”)
wscript.sleep 500
ws.sendkeys(“r”)
wscript.sleep 500
ws.sendkeys(“y”)
wscript.sleep 500
ws.sendkeys(” “)
wscript.sleep 500
ws.sendkeys(“:”)
wscript.sleep 500
ws.sendkeys(chr(10))
wscript.sleep 500
ws.sendkeys(“I”)
wscript.sleep 500
ws.sendkeys(“.”)
wscript.sleep 500
ws.sendkeys(“.”)
wscript.sleep 500
ws.sendkeys(“.”)
wscript.sleep 500
ws.sendkeys(chr(10))
wscript.sleep 500
ws.sendkeys(“I”)
wscript.sleep 500
ws.sendkeys(” “)
wscript.sleep 500
ws.sendkeys(“l”)
wscript.sleep 500
ws.sendkeys(“o”)
wscript.sleep 500
ws.sendkeys(“v”)
wscript.sleep 500
ws.sendkeys(“e”)
wscript.sleep 500
ws.sendkeys(” “)
wscript.sleep 500
ws.sendkeys(“y”)
wscript.sleep 500
ws.sendkeys(“o”)
wscript.sleep 500
ws.sendkeys(“u”)
wscript.sleep 500
代码挺简单的,这里就不再分析了。
捐赠本站(Donate)
如您感觉文章有用,可扫码捐赠本站!(If the article useful, you can scan the QR code to donate))
- Author: shisekong
- Link: https://blog.361way.com/vbsleep/242.html
- License: This work is under a 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议. Kindly fulfill the requirements of the aforementioned License when adapting or creating a derivative of this work.