开发者

CruiseControl.Net not playing nice with PowerShell

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


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...


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:

mklink /D c:\powershell "C:\WINDOWS\system32\WindowsPowerShell\v1.0"

and then

<script>RunScout3G.ps1</script>
<executable>C:\powershell\PowerShell.exe</executable>

btw, if you use Powershell V2, is that the correct path?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜