'how to properly use COPY instruction in postBuild action

I would like to perform postBuild action in MS Visual Studio 2022 / C# project.

The action is to copy the executable into a different folder. However the folder is not yet created so the copy instruction fails. How to use the copy instruction in a way it creates the required directory or something other like mkdir? Is anywhere a list of available commands?

<Target Name="PostBuild" AfterTargets="PostBuildEvent">
  <Exec Command="MKDIR $(SolutionDir)Outputs&#xD;&#xA;copy /Y $(TargetDir)$(TargetName).exe $(SolutionDir)Outputs\$(TargetName).exe" />
</Target>


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source