Board logo

标题: [已解决]VBS生成VBS [打印本页]

作者: zinet    时间: 2009-5-4 00:19     标题: [已解决]VBS生成VBS

请问如何让vbs运行时生成另外一个指定代码的vbs
例如:要执行运行1.vbs代码如下
Set a = CreateObject("Wscript.Shell")
a.Run("http://www.baidu.com")
wscript.sleep 1000
Set b = CreateObject("Wscript.Shell")
b.Run"qq.exe"
                           
wscript.sleep 2000
a.run"taskkill /f /im 126.exe",0

Set WshShell=WScript.CreateObject("WScript.Shell")
WshShell.SendKeys"+{TAB}"
如何让上面代码运行时把红色那部分代码生成为2.vbs
注:1.vbs运行时不用执行红色那部分代码(红色那部分代码只作生成用),而直接跳过红色继续执行余下命令

[ 本帖最后由 zinet 于 2009-5-4 12:25 编辑 ]
作者: rat    时间: 2009-5-4 10:55

  1. With CreateObject("Scripting.FileSystemObject").CreateTextFile("2.vbs", True)
  2. .WriteLine "Set b = CreateObject(""Wscript.Shell"")"
  3. .WriteLine "b.Run""qq.exe"""
  4. .WriteLine "wscript.sleep 2000"
  5. .WriteLine "a.run""taskkill /f /im 126.exe"",0"
  6. .Close
  7. End With
复制代码





欢迎光临 批处理之家 (http://www.bathome.net/) Powered by Discuz! 7.2