VBS中启动exe程序:
1 set ws=WScript.CreateObject("WScript.Shell")
2 ws.Run "AutoUpdateEx.exe",0,true
3 ws.Run "打印配置工具.exe",0,true
4 ws.Run "DOMASClientMonitor.exe",0,true
5 ws.Run "PrinterMonitorEx.exe",0,false
VBS中启动exe程序绝对路径:
1 set ws=WScript.CreateObject("WScript.Shell")
2 ws.Run """C:\Program Files\Test\AutoUpdateEx.exe""",0,true
3 ws.Run """C:\Program Files\Test\DOMASClientMonitor.exe""",0,false
4 ws.Run """C:\Program Files\Test\PrinterMonitorEx.exe""",0,false
5 ws.Run """C:\Program Files\Test\打印配置工具.exe""",0,false
ws.Run实际参数是"C:\Program Files\Test\AutoUpdateEx.exe",因为带空格,先将它括起来作为一个整体,而两侧的"按要求应该用转义""表示,故成为""C:\Program Files\Test\AutoUpdateEx.exe"",而Run本身调用参数就得在外部加一对引号,故共有三对引号。用msgbox"""C:\Program Files\Test\AutoUpdateEx.exe"""可验证结果为"C:\Program Files\Test\AutoUpdateEx.exe"。对于Run方法,可以统一都用三个引号,ws.Run"""C:\"""同样可以解析;本例也可用ws.Run"C:\progra~1\Test\AutoUpdateEx.exe"来实现。
posted on 2012-04-16 12:41
王海光 阅读(2812)
评论(0) 编辑 收藏 引用 所属分类:
脚本