This is the error message I got when I ran the pipeline in Azure Devops:

The syntax of the command is incorrect. The system cannot find the file specified. ##[error]Cmd.exe exited with code '1'.

I can't tell what is wrong with the Yaml script

 - script: | # Build your HTML and CSS files (No actual compilation, just copying)
        mkdir -p $(Build.BinariesDirectory)/website
        copy -R * $(Build.BinariesDirectory)/website/
      displayName: 'Copy Website Files'
1

There are 1 best solutions below

1
Andy Li-MSFT On

The problem is that you are using the Windows agent to run the linux copy command.

And according to my test the copy -R command is not valid in linux. We need to use cp -R. Reference this thread for more information : https://unix.stackexchange.com/questions/18712/difference-between-cp-r-and-cp-r-copy-command

The following Yaml works for me:

pool:
  vmImage: ubuntu-latest

steps:

- script: |
    mkdir -p $(Build.BinariesDirectory)/website
    cp -R * $(Build.BinariesDirectory)/website/
  displayName: 'Copy Website Files'