MSBuild / cmd Task "was unexpected at this time"
===

Basically I have a command which will copy the contents of a source directory (and sub-directories), and flatten the structure into a target directory, overwriting any duplicates.

This is the raw command that works from the command line

    for /r 5.1.0.60 %f in (*) do @copy "%f" "deployment" /y
in this instance where

- "5.1.0.60" is the output directory of a prior TeamCity / MSBuild task
- "deployment" is the target directory for the flattened output of the step


However, when I run this command from inside of an MSBuild task (ultimately as part of a TeamCity build), I am getting the following error

    f" deployment /y was unexpected at this time

I have the following basic msbuild script that exhibits the issue:

    <Project DefaultTargets="flatten"
            xmlns="http://schemas.microsoft.com/developer/msbuild/2003"
            ToolsVersion="3.5">
    <Import Project="$(MSBuildExtensionsPath)\MSBuildCommunityTasks\MSBuild.Community.Tasks.Targets" />

      <PropertyGroup>
        <SourceDir>5.1.0.60</SourceDir>
        <TargetDir>deployment</TargetDir>
      </PropertyGroup>
            
      <Target Name="flatten">
        <!-- create our deployment directory -->
        <MakeDir Directories="$(TargetDir)"/>

        <!-- Copy all files flattenend to the deployment directory-->
        <Message Text="##Command  [for /r $(SourceDir) %f in (*) do @copy &quot;%f&quot; $(TargetDir) /y]"/>
        <Exec Command="for /r $(SourceDir) %f in (*) do @copy &quot;%f&quot; $(TargetDir) /y" />

      </Target>    
    </Project>

Ultimately, if a past the line

    for /r 5.1.0.60 %f in (*) do @copy "%f" "deployment" /y

into a batch file and run the batch file on its own (outside of msbuild) I get the same error, so presumably it's strictly a cmd issue rather than MSBuild, though since I image this is a common task in MSBuild / TeamCity I've tagged those as well.

Any help or pointers would be most appreciated.
(NB windows 7 pro, TeamCity 6.5)