PostBuildEvent Create Directory

Deepak picture Deepak · May 9, 2012 · Viewed 25.8k times · Source

I'm trying to create a folder named Design in the build output folder using th following commandline in the PostBuildEvent in visual studio

mkdir $(TargetDir)Design  ....Runs Successfully but folder is not created
mkdir "$(TargetDir)Design" ....Runs Successfully but folder is not created
MD $(TargetDir)Design  ....Runs Successfully but folder is not created
MD "$(TargetDir)Design"  ....Runs Successfully but folder is not created

Can anyone tell me what I'm doing wrong

Answer

Eric picture Eric · Oct 29, 2014

You need to do something like:

if not exist DirToCreate mkdir DirToCreate