Run

运行外部程序.

Run ( "程序" [, "工作目录" [, 显示标志[, 可选标志]]] )

 

参数

程序 程序所在的完整路径(文件格式为 EXE,BAT,COM 或 PIF). 工作目录 [可选参数] 工作目录.这个路径不一定指向程序所在路径. 显示标志 [可选] 启动程序时的初始状态:
  @SW_HIDE = 隐藏窗口
  @SW_MINIMIZE = 最小化窗口
  @SW_MAXIMIZE = 最大化窗口 可选标志 [可选] 控制不同选项处理父进程与子进程交互.
  0x1 ($STDIN_CHILD) = 提供一个句柄到子进程的 STDIN 流.
  0x2 ($STDOUT_CHILD) = 提供一个句柄到子进程的 STDOUT 流.
  0x4 ($STDERR_CHILD) = 提供一个句柄到子进程的 STDERR 流.
  0x8 ($STDERR_MERGED) = Provides the same handle for STDOUT and STDERR. Implies both $STDOUT_CHILD and $STDERR_CHILD.
  0x10 ($STDIO_INHERIT_PARENT) = Provide the child with the parent's STDIO streams. This flag can not be combined with any other STDIO flag. This flag is only useful when the parent is compiled as a Console application.
  0x10000 ($RUN_CREATE_NEW_CONSOLE) = The child console process should be created with it's own window instead of using the parent's window. This flag is only useful when the parent is compiled as a Console application.

 

返回值

成功: 返回所运行程序的 PID(进程标识符). 失败: 返回0并设置 @error 为非0值.

 

注意/说明

如果路径中含有空格,请在两侧添加英文引号(").

要运行 DOS(控制台)命令,请使用 Run(@ComSpec & " /c " & 'commandName', "", @SW_HIDE) ;不要忘了 "/c" 前面的 " "

在运行指定程序后脚本将(立即)继续执行后面的语句.若要在指定程序执行完毕之前暂停脚本的执行则请使用 RunWait 函数代替.

_RunDOS

在一个隐藏的命令窗口中执行一个 DOS 命令.

#include <Process.au3>
_RunDOS ( $sCommand )

 

参数

$sCommand 要执行的命令

 

返回值

成功: 返回所执行命令的退出代码 失败: 返回 0 并设置 @error 为非0.
没有登录不能评论