从另一个vbscript运行vbscript,是否有可能立即将输出发送到这样的文件:
dim shell
set shell=createobject("wscript.shell")
strCMD =replace("'myvbs.vbs' '"&a_parameter&"' ","'","""")
shell.Run strCMD >output.txt
提前感谢
答案 0 :(得分:0)
是的,你可以。试试这个例子。
'script1.vbs -----------------
Dim oShell, strCMD
Set oShell = CreateObject("WScript.Shell")
strCMD = Replace("CMD /C CScript.exe 'script2.vbs' " & 3, "'", """")
oShell.Run strCMD & " //NoLogo >output.txt", 0, True
'script2.vbs -----------------
result = WScript.Arguments(0) ^ 2
WScript.StdOut.Write result
看看这个answer。