CruiseControl.Net 与 PowerShell 配合不佳
这是我的 PowerScript 任务,
<powershell>
<script>RunScout3G.ps1</script>
<executable>C:\WINDOWS\system32\WindowsPowerShell\v1.0\PowerShell.exe</executable>
<scriptsDirectory>C:\Program Files\CruiseControl.NET\Our_PowerShell</scriptsDirectory>
<buildArgs></buildArgs>
<successExitCodes>0</successExitCodes>
<buildTimeoutSeconds>900</buildTimeoutSeconds>
<description>Example of how to run a PowerShell script.</description>
</powershell>
错误是这样的......
<buildresults>
<message level="Error">The term 'C:\Program' is not recognized as the name of a cmdlet, function, scri </message>
<message level="Error">pt file, or operable program. Check the spelling of the name, or if a path was </message>
<message level="Error">included, verify that the path is correct and try again.</message>
<message level="Error">At line:1 char:11 </message>
<message level="Error">+ C:\Program <<<< Files\CruiseControl.NET\JCDC_PowerShell\RunScout3G.ps1 </message>
<message level="Error"> + CategoryInfo : ObjectNotFound: (C:\Program:String) [], CommandN </message>
<message level="Error"> otFoundException </message>
<message level="Error"> + FullyQualifiedErrorId : CommandNotFoundException </message>
<message level="Error"> </message>
问题出在scriptsDirectory 上。驱动器名称“Program Files”中有一个空格。
如果我尝试将 ' 放在它周围,或者 " 放在它周围,巡航控制会说无效驱动。 任何帮助都会很棒。
PowerShell 版本为 V2
CruiseControl.Net 版本为 1.5.6755.1
Here is my PowerScript Task
<powershell>
<script>RunScout3G.ps1</script>
<executable>C:\WINDOWS\system32\WindowsPowerShell\v1.0\PowerShell.exe</executable>
<scriptsDirectory>C:\Program Files\CruiseControl.NET\Our_PowerShell</scriptsDirectory>
<buildArgs></buildArgs>
<successExitCodes>0</successExitCodes>
<buildTimeoutSeconds>900</buildTimeoutSeconds>
<description>Example of how to run a PowerShell script.</description>
</powershell>
The Error is this...
<buildresults>
<message level="Error">The term 'C:\Program' is not recognized as the name of a cmdlet, function, scri </message>
<message level="Error">pt file, or operable program. Check the spelling of the name, or if a path was </message>
<message level="Error">included, verify that the path is correct and try again.</message>
<message level="Error">At line:1 char:11 </message>
<message level="Error">+ C:\Program <<<< Files\CruiseControl.NET\JCDC_PowerShell\RunScout3G.ps1 </message>
<message level="Error"> + CategoryInfo : ObjectNotFound: (C:\Program:String) [], CommandN </message>
<message level="Error"> otFoundException </message>
<message level="Error"> + FullyQualifiedErrorId : CommandNotFoundException </message>
<message level="Error"> </message>
The problem is with scriptsDirectory. There is a space in the drive name "Program Files".
If I try and put ' around it, or " around it cruisecontrol says invalid drive.
Any help would be awesome.
Version of PowerShell is V2
Version of CruiseControl.Net is 1.5.6755.1
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您还可以尝试使用 8 个字符的目录名称。如果您运行dir /x,您将看到缩写的名称。它们中永远不会有任何空格,因此这是避免转义字符问题的好方法。在您的情况下,它应该看起来像 c:\PROGRA~1\CRUISE~1...
You could also try using the 8 character directory names. If you run dir /x you will see the shortened names. They will never have any spaces in them, so it's a nice way to avoid the escaped character issues. In your case it should look like c:\PROGRA~1\CRUISE~1...
好的,如果它不接受引号(您在 XML 语法中尝试过 " 吗?),根据您的系统,也许您可以链接到正确的驱动器,这样您就可以使用 powershell 可执行文件的新路径:
然后
顺便说一句,如果您使用 Powershell V2,这是正确的路径吗?
OK, if it doesn't accept quotes (have you tried " in the XML syntax?), depending on your system, maybe you can make a link to the correct drive, such that you can use the new path to the powershell executable:
and then
btw, if you use Powershell V2, is that the correct path?