Search code examples
visual-studiocommand-linenmake

visual studio nmake copy command filed with exit code 1


In my Build Command Line for a NMAKE visual studio project I have this:

NMake /NOLOGO /R /F ...
copy D:\myfile $(outdir)..\..\mynewfile.txt

Both of these files exist in the specified locations but i get the following build error:

2>  The system cannot find the file specified.
2>C:\Program Files (x86)\MSBuild\...\Microsoft.MakeFile.Targets(37,5): error MSB3073: The command "NMake /NOLOGO /R ...
2>C:\Program Files (x86)\MSBuild\...\Microsoft.MakeFile.Targets(37,5): error MSB3073: copy D:\myfile ..\..\mynewfile.txt" exited with code 1.

Solution

  • A copy command in the visual studio build command line must always have quotation marks regardless of the path (ie. whether it has spaces or not). The command needs to be:

    copy "D:\myfile" "$(outdir)..\..\mynewfile.txt"