Installing Yii 2 starter kit on Windows error: `'cp' is not recognized .. event returned with error code 1`

Installing Yii 2 starter kit on Windows error: `'cp' is not recognized .. event returned with error code 1`

在Windows上使用推荐的命令composer run-script docker:build安装Yii 2 starter kit时如何解决,为什么会出现这个错误?

'cp' is not recognized as an internal or external command,
operable program or batch file.
Script cp .env.dist .env handling the build:env event returned with error code 1
Script @build:env was called via docker:build```

这是因为在 Windows 女士的操作系统中通常无法使用命令 cp 它必须当前在根目录的 composer.json 文件中编辑,scripts->build.env 部分必须已将 cp 命令更改为 copy 作为临时解决方法

scripts": {
    "build:env": [
      "cp .env.dist .env"
    ],

scripts": {
    "build:env": [
      "copy .env.dist .env"
    ],