这个 自定义任务 剖面图 Tasks in Visual Studio Code 描述任务的属性。有一个 type 定义任务类型的属性:
type
类型 :任务的类型。对于自定义任务,这可以是 shell 或 process . 如果 壳 如果指定,该命令将解释为shell命令(例如:bash、cmd或powershell)。如果 过程 如果指定,则该命令将被解释为要执行的进程。
shell
process
壳
过程
我不明白他们之间有什么不同。不管我选择什么 壳 或 过程 ,所有执行结果都相同。
所以两者有什么不同 解释为shell命令 和 命令被解释为要执行的进程 真的吗?
shell命令只能在shell内部运行,例如 DIR 对于 cmd 和 if 对于 bash . 因此,当您想运行shell命令时,必须使用 "type": "shell" 设置为正确运行。当你想运行一个程序,比如 .bat , .sh 或 .exe ,然后您就可以使用 "type": "process" 设置。
DIR
cmd
if
bash
"type": "shell"
.bat
.sh
.exe
"type": "process"