cfexecute with pipe(|)字符命令不起作用

时间:2013-03-11 07:15:52

标签: coldfusion coldfusion-9 cfml

我正在尝试执行sc查询命令:

<cfexecute name = "sc"
  arguments='\\192.168.7.152 queryex type= service state= all | find "Apache2.2"'
  timeout = "10" variable="scVal">
</cfexecute>

<cfdump var="#scVal#">

但它失败并显示错误消息:“超时期限已到期而未完成sc”。但是,如果我通过命令提示符运行它,它就可以工作。

执行以下单个命令也有效:

<cfexecute name = "sc"
    arguments = '\\192.168.7.152 queryex type= service state= all'
    timeout = "10" variable="scVal">
</cfexecute>

<cfdump var="#scVal#">

我想它无法识别它是双重命令或管道符号问题。

1 个答案:

答案 0 :(得分:0)

要使管道命令工作,请尝试添加插入符号(^)作为转义字符

<cfexecute name = "sc"
  arguments='\\192.168.7.152 queryex type= service state= all ^| find "Apache2.2"'
  timeout = "10" variable="scVal">
</cfexecute>

<cfdump var="#scVal#">