0

I am trying to execute an sc query command:

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

<cfdump var="#scVal#">

But it fails with the error message: "Timeout period expired without completion of sc". Yet, if I run it via the command prompt, it works.

Executing the single command below also works:

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

<cfdump var="#scVal#">

I guess it can't recognize that it is a double command or there is a pipe character issue.

4

1 に答える 1

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#">
于 2013-08-13T01:20:41.130 に答える