执行cmd指令 - ExecuteCmd
函数简介
执行指定的CMD指令,并返回cmd的输出结果
接口名称
ExecuteCmd
DLL调用
long ExecuteCmd(long ola, string cmd, string current_dir, int time_out)
参数定义:
ola
(长整型数): OLAPlug对象的指针,由 CreateCOLAPlugInterFace 接口生成。cmd
(字符串): 要执行的cmd命令。current_dir
(字符串): 执行此cmd命令时所在目录。如果为空,表示使用当前目录。比如""或者"c:"。time_out
(整型数): 超时设置,单位是毫秒。0表示一直等待。大于0表示等待指定的时间后强制结束,防止卡死。
示例:
待补充...
COM调用
string ExecuteCmd(string cmd, string current_dir, int time_out)
参数定义:
cmd
(字符串): 要执行的cmd命令。current_dir
(字符串): 执行此cmd命令时所在目录。如果为空,表示使用当前目录。比如""或者"c:"。time_out
(整型数): 超时设置,单位是毫秒。0表示一直等待。大于0表示等待指定的时间后强制结束,防止卡死。
示例:
待补充...
返回值
字符串:
cmd指令的执行结果. 返回空字符串表示执行失败.
注意:
DLL调用返回字符串指针地址,需要调用 FreeStringPtr接口释放内存