我新建了一个A.vbs的脚本文件,想通过它来偷懒,应为都是重复劳动,代码如下
Dim wshshell
set wshshell=CreateObject("wscript.shell")
wscript.sleep 2000
WshShell.Run "cmd"
wscript.sleep 1000wscript.sleep 2000
wshshell.sendkeys "yddx"
wshshell.sendkeys "{ENTER}"
wscript.sleep 1000
wshshell.sendkeys "yddx@s6506"
wshshell.sendkeys "{ENTER}"
wscript.sleep 1000
wshshell.sendkeys "super"
wshshell.sendkeys "{ENTER}"
wscript.sleep 1000
wshshell.sendkeys "jxyddx@s6506"
wshshell.sendkeys "{ENTER}"wscript.sleep 10000
我的工作中有N个这样的脚本文件需要一个接一个运行,需要占用大量时间,在运行这些脚本的时候我的电脑就不能再使用了,因为当激活其他的窗口时,双引号里面的文字就会在该窗口中输入,影响了脚本正常运行,请教大家有什么办法可以设置让这些文件在后台运行而不会影响我正常使用电脑。

解决方案 »

  1.   

    batch, 
    echo, sleep.
    最主要的你省略了。
      

  2.   

    我的意思是写出bat文件。
    用echo代替sendkey
    sleep 1 代替 sleep 1000.
    你的代码不全。
      

  3.   

    用sendKey的话,基本没办法干其它事情
      

  4.   

    不用sendKey的话,那用什么方法?
      

  5.   

    晕死,大家都不用A.vbs文件的么?
      

  6.   

    用以下脚本建立一个A.vbs文件,运行它,它会打开一个记事本然后自动输入双引号的字母,它运行的时候电脑就被它占用了,假如在这个时候打开其他文件,字母就会被输入新打开的文件中,从而影响了vbs文件运行的目的。如何在它运行的时候我们还可以正常使用电脑而不会影响它的运行?
    Dim wshshell
    set wshshell=CreateObject("wscript.shell")
    wscript.sleep 2000
    WshShell.Run "notepad"
    wscript.sleep 1000wscript.sleep 2000
    wshshell.sendkeys "yddx"
    wshshell.sendkeys "{ENTER}"
    wscript.sleep 1000
    wshshell.sendkeys "yddx@s6506"
    wshshell.sendkeys "{ENTER}"
    wscript.sleep 1000
    wshshell.sendkeys "super"
    wshshell.sendkeys "{ENTER}"
    wscript.sleep 1000
    wshshell.sendkeys "jxyddx@s6506"
    wshshell.sendkeys "{ENTER}"wscript.sleep 10000