分享

Exec Method (Windows Script Host)

 clhon 2011-07-12

Exec Method (Windows Script Host)

Windows Scripting 5.8

Runs an application in a child command-shell, providing access to the StdIn/StdOut/StdErr streams.

                      object.Exec(strCommand)
object

WshShell object.

strCommand

String value indicating the command line used to run the script. The command line should appear exactly as it would if you typed it at the command prompt.

The Exec method returns a WshScriptExec object, which provides status and error information about a script run with Exec along with access to the StdInStdOut, and StdErr channels. The Exec method allows the execution of command line applications only. The Exec method cannot be used to run remote scripts. Do not confuse the Execmethod with the Execute method (of the WshRemote object).

The following example demonstrates the basics of the Exec method.

Dim WshShell, oExec
Set WshShell = CreateObject("WScript.Shell")

Set oExec = WshShell.Exec("calc")

Do While oExec.Status = 0
     WScript.Sleep 100
Loop

WScript.Echo oExec.Status
No code example is currently available or this language may not be supported.

Applies To:

    本站是提供个人知识管理的网络存储空间,所有内容均由用户发布,不代表本站观点。请注意甄别内容中的联系方式、诱导购买等信息,谨防诈骗。如发现有害或侵权内容,请点击一键举报。
    转藏 分享 献花(0

    0条评论

    发表

    请遵守用户 评论公约

    类似文章 更多