我的批处理脚本在代码后停止执行。命令

My batch script stops execution after the code . command

这是我的简单批处理脚本:

d:
cd D:/test_folder/test_project
start chrome -incognito http://localhost:19002
code .
expo start

脚本只执行到 code . 行,然后给出提示。世博会开始永远不会 运行。可能是什么问题呢?如何在 code . 行之后继续执行?

编辑: 如果我删除 code . 行,该文件将按预期工作。

看了很多帖子,发现vs code的打开方式是:

d:
cd D:/test_folder/test_project
start chrome -incognito http://localhost:19002
start "" code D:/test_folder/test_project
expo start

这按要求工作。

VaibhavJoshi 的回答几乎对我有用:一个新的 cmd 在脚本结束之前开始,我不想要这个。

在我这边,where code 产生两个结果:

C:\> where code
C:\Users\MyUser\AppData\Local\Programs\Microsoft VS Code\bin\code
C:\Users\MyUser\AppData\Local\Programs\Microsoft VS Code\bin\code.cmd

为了防止在 start "" code 上启动新的 cmd,我不得不直接使用 .exe

set vscode="%localappdata%\Programs\Microsoft VS Code\Code.exe"

rem some other stuff ...

start "" %vscode% --folder-uri vscode-remote://ssh-remote+10.3.3.3/path/to/my/project

在本地和远程项目中表现出色。