PostBuildEvent Create Directory
28,120
Solution 1
You need to do something like:
if not exist DirToCreate mkdir DirToCreate
Solution 2
This worked for me (where Design is the folder you want to create):
mkdir $(TargetDir)\Design
If you want to check for existence first:
if not exist $(TargetDir)\Design mkdir $(TargetDir)\Design
Solution 3
In addition to the two previous answers, you could use a variable like this :
SET path=$(TargetDir)\Design
if not exist "%path%" mkdir "%path%"
That way, you'll avoid any duplication. (Tested with VS2019)
Author by
Deepak
Updated on July 17, 2020Comments
-
Deepak almost 4 years
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