Domanda

I have an nant build where I am trying to call a powershell cmdlet like below:

<exec program="powershell.exe" commandline='.\Download.ps1 ${dir}' />

This works fine as long as there dir path doesn't contain white spaces and throws below error:

A positional parameter cannot be found that accepts argument .....

I tried below to fix this but that doesn't work.

<exec program="powershell.exe" commandline='.\Download.ps1 "${dir}"' />
È stato utile?

Soluzione 2

Got is fixed by modifying the exec task as:

<exec program="powershell.exe" commandline=".\Download.ps1 '${dir}'" />

Altri suggerimenti

Try this instead:

<exec program="powershell.exe">
    <arg value=".\Download.ps1"/>
    <arg value="${dir}"/>
</exec>
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top