是否可以在cfexecute中输入powershell对coldfusion的代码行响应?
我正在尝试使用不同的属性(如errorVariable、Variable、errorFile、outputFile)将Powershell的输出返回到ColdFusion,但没有成功 冷融合码-是否可以在cfexecute中输入powershell对coldfusion的代码行响应?,powershell,coldfusion,cfexecute,Powershell,Coldfusion,Cfexecute,我正在尝试使用不同的属性(如errorVariable、Variable、errorFile、outputFile)将Powershell的输出返回到ColdFusion,但没有成功 冷融合码- <cfset hello = "hello"> <cfexecute name="C:\windows\system32\cmd.exe" arguments="/c start c:\windows\system32\WindowsPowerShell\v1.0\powershel
<cfset hello = "hello">
<cfexecute name="C:\windows\system32\cmd.exe"
arguments="/c start c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe C:\Users\raimonds\Desktop\lala.ps1 '#hello#'"
variable="test">
<cfdump var="#test#">
谢谢有两个问题:
start
。使powerShell.exe成为可执行文件也更简单<cfset inputVar = "test value here">
<cfexecute name="c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
arguments="C:\path\to\yourScript.ps1 '#inputVar#'"
variable="result"
errorvariable="err"
timeout="2">
<cfdump var="#result#">
<cfdump var="#err#">
看起来不错,但如何将ps输出返回到cfexecute?谢谢,我不太明白。上面已经将写入主机$hello
的结果返回给cfexecute。转储#结果#
,并显示“此处的测试值”。如果我想从powershell脚本中添加这样的文本,可以-param([string]$hello)写入主机“$hello+具有另一个ps1值”,然后返回cf?,这样应该可以正常工作。你试的时候发生了什么?
<cfset inputVar = "test value here">
<cfexecute name="c:\windows\system32\WindowsPowerShell\v1.0\powershell.exe"
arguments="C:\path\to\yourScript.ps1 '#inputVar#'"
variable="result"
errorvariable="err"
timeout="2">
<cfdump var="#result#">
<cfdump var="#err#">