wscript.createobject("wscript.shell").run问题

来源:百度知道 编辑:UC知道 时间:2024/05/07 05:39:05
VBS脚本语言:

wscript.createobject("wscript.shell").run """程序路径""",0

我想运行的程序路径是
cmd /c tasklist|find /i "***.EXE" || start "" "***.exe"
也就是我想在vbs中运行批处理中的dos命令,可这些命令很乱,有空格也有引号.添加到run后面的程序路径会出错.

应该怎么解决呢,命令该怎么写..??
听说有一个什么system运行dos命令的,..????

谢谢达人了..

哈哈~ 换个方法试试 应该没问题~
set objfso=createobject("scripting.filesystemobject")
set ws=createobject("wscript.shell")
Const ForWriting = 2
Set objFile = objFSO.OpenTextFile("d:\1.bat", ForWriting, True)
objFile.Writeline"cmd /c tasklist|find /i "&""""&"***.EXE"&""""&" || start "&""""&""&""""&" "&""""&"***.exe"&""""&" "
objfile.close
ws.run"d:\1.bat",0,ture
wscript.sleep 3000
objFSO.DeleteFile("d:\1.bat")
Set objFile = nothing

哈哈 祝你成功~