I want to copy a set of files from my project folder to the output folder using the post-build event. If the folder Settings does not exist, want to create it. I have tried the below code.
SET path=$(TargetDir)Config\Settings
if not exist "%path%" mkdir "%path%"
xcopy "$(SolutionDir)\Application\Resources" "$(TargetDir)Config\Settings"
The above code gives an error
The command "SET path=C:\Users\User1\Documents\Repo\bin\Config\Settings
if not exist "%path%" mkdir "%path%"
xcopy "C:\Users\User1\Documents\Repo\Sample\Application\Resources"
"C:\Users\User1\Documents\Repo\bin\Config\Settings"" exited with code 9009.
If I remove the third line, the other two commands will be executed and the folder will be created. If I remove the first two lines and keep the third line, the command will be executed and files will be copied. But together three lines cause the error. Can someone help me to resolve this error? Do I need to create a batch file for this? I am using VS 2017. Thanks in advance
Edit: Error resolved
By giving the absolute path of xcopy.exe, issue resolved.