سؤال

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}"' />
هل كانت مفيدة؟

المحلول 2

Got is fixed by modifying the exec task as:

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

نصائح أخرى

Try this instead:

<exec program="powershell.exe">
    <arg value=".\Download.ps1"/>
    <arg value="${dir}"/>
</exec>
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top