Windows bat 脚本在多行命令失败

Windows bat script fails with command on multiple line

我有两台机器需要运行一个脚本如下:

cd C:\my_project\
git pull
set ENV=prod
set USERNAME=me
poetry config virtualenvs.create false
poetry install
poetry run python -m my_module

以下是两台机器的版本:

机器 1

>cmd /version
Microsoft Windows [version 10.0.19042.1348]
(c) Microsoft Corporation. Tous droits réservés.

机器 2

>cmd /version
Microsoft Windows [version 10.0.19042.1288]
(c) Microsoft Corporation. Tous droits réservés.

脚本 运行 在机器 2 上运行良好,但在机器 1 上执行第一个诗歌命令后停止。我必须修改机器 1 上的脚本,将所有诗歌命令分隔在一行中使用 & 以获得 运行 正确的脚本。

cd C:\my_project\
git pull
set ENV=prod
set USERNAME=me
poetry config virtualenvs.create false & poetry install & poetry run python -m my_module

更多上下文:

这是Windows版本问题吗?这是某些资源(内存,CPU...)的问题吗?这是 encoded/invisible 个字符的问题吗?诗歌的安装问题?

在您的机器上1 - 诗歌是一个批处理文件!
您可以改用 call poetry

可能你安装诗歌的方式不同。

This is a bug in the get-poetry.py install script, it creates poetry.bat on Windows, so the closest shell is always cmd.exe.

Workaround is to install Poetry using pip or pipx.

On windows poetry shell always start a cmd