【发布时间】:2012-02-10 14:42:21
【问题描述】:
我正在尝试使用 TC 中的 Powershell Runner 运行一些 PS 脚本,并将我自己的脚本定义为“源代码”而不是脚本文件。 我的脚本很简单:
"Hello World!"
我在 Windows Server 2008 R2 上运行,我尝试过:
- 以 x86 + x64 运行它
- 使用“使用“-File”参数执行 .ps1”+“使用“-Command -”参数将脚本放入 powershell 标准输入。
- 我已将安全策略设置为无限制以尝试使其正常工作,但没有成功。
如果我改用命令行运行器,例如写:
powershell -Command Get-ExecutionPolicy
效果很好。
我遇到的错误(取决于我使用的两种执行模式中的哪一种)是:
Starting: C:\...\cmd.exe /c C:\...\powershell.exe -NonInteractive -Command
- "<C:\...\powershell3889347351955805274.ps1" && exit /b %ERRORLEVEL%
in directory: C:\...\e18dda4054c166c7
'-' was specified with the -Command parameter; no other arguments to -Command are permitted.
或
Starting: C:\...\cmd.exe /c C:\...\powershell.exe -NonInteractive -File
"C:\...\powershell8264270201473986040.ps1" && exit /b %ERRORLEVEL%
in directory: C:\...\e18dda4054c166c7
The term 'f' is not recognized as the name of a cmdlet, function, script file,
在我看来,TC 在实际脚本本身中添加了一些内容,但我不确定。我卡住了,我无法弄清楚我在这里缺少什么:S.
谁能帮忙?
【问题讨论】:
-
另见stackoverflow.com/questions/9165658/… (首先使用我的搜索keyworkds点击这个,但真正的问题是在某些事情上进入标准输入模式会阻塞,例如,如果TC 7.0中的块)
标签: powershell teamcity