2013-03-11 42 views
0

我試圖執行一個sc查詢命令:cfexecute用管道(|)字符命令不工作

<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#"> 

我猜它不能認識到這是一個雙指令或存在豎線問題。

+4

在批處理文件並運行,而不是把命令。 – 2013-03-11 12:27:04

+0

已嘗試用ASC(123)替換管道字符? – 2013-03-13 20:23:37

回答

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#">