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.

James A Mohler
  • 11,060
  • 15
  • 46
  • 72
user1479328
  • 13
  • 1
  • 4

1 Answers1

0

To make the pipe command work try adding a caret (^) as the escape character

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

<cfdump var="#scVal#">
bcadiz
  • 1