EXEC task with '|' in arguments

I'm trying to do a VS build using the hyperibuild method in my ANT script, but for some reason the exec task fails with the following error:

"Win32" is not recognized as an internal or external command

when i use the following code:

<arg line='buildconsole solution.sln /rebuild /cfg="Release|Win32"' />

      

I think ANT script can handle '|' as a separator or something ...

Any ideas how I can get this to work?

I've also tried the following, but nothing helps me:

<arg line='buildconsole solution.sln /rebuild /cfg="Release&#124;Win32"' />

<arg value="buildconsole solution.sln /rebuild /cfg=&quot;Release|Win32&quot;" />

<arg value="buildconsole solution.sln /rebuild /cfg=&quot;Release&#124;Win32&quot;" />

      

+1


a source to share


3 answers


Hmm ... I just tried again and it worked, but only after I switched to

<arg value="buildconsole solution.sln /rebuild /cfg=Release^|Win32" />

      



so I think the quotes around Release ^ | Win32 is not needed if I use value.

Thanks a bunch!

+1


a source


You need to escape the pipe character by preceding it with the ^ character. So:

<arg line='buildconsole solution.sln /rebuild /cfg="Release^|Win32"' />

      




EDIT:

Are you sure the carriage isn't working? It seems that in this example ant file:

<?xml version="1.0" encoding="UTF-8"?>

<project name="Test" default="build" basedir=".">

    <target name="build">
        <exec executable="cmd">
            <arg line="/k echo cfg=&quot;Release^|Win32&quot;"/>
        </exec>
    </target>

</project>

      

+3


a source


I think the problem is that the Windows command prompt displays the message | and treats him as a "pipe" operator. Maybe get out of the pipe using:

<arg line = 'buildconsole solution.sln / rebuild / cfg = "Release \ | Win32"' />

0


a source







All Articles