visual-studio-code - 为什么在执行带有 VS 代码任务的 Windows 批处理文件时看不到任何输出
问题描述
我第一次尝试 VS 代码任务,我创建了一个test.bat
文件
echo hello
和这个tasks.json
{
// See https://go.microsoft.com/fwlink/?LinkId=733558
// for the documentation about the tasks.json format
"version": "2.0.0",
"tasks": [
{
"label": "test",
"type": "shell",
"command": "cmd /c c:\\test\\test.bat"
}
]
}
运行任务时,它似乎执行它,但为什么我看不到 echo 的任何输出(即“hello”)?
解决方案
参数不应该发布在 中command
,所以你的任务应该是这样的:
{
"command": "cmd",
"args": ["/c", "c:\\test\\test.bat]
}
但是,由于 Microsoft 添加了自动检测,因此以下内容也应该有效:
{
"type": "shell",
"command": ""c:\\test\\test.bat"
}
有关详细信息,请参阅自定义任务文档。
推荐阅读
- c# - 如何检查数组中的多个值是否等于一个字符串?
- python - partial_run() 需要空的 target_list
- javascript - 如何设置元素以重叠滚动
- javascript - 以编程方式或使用用户输入从 iframe 捕获 URL
- java - StringUtils 重载斩波方法
- c# - PInvoke Marshalling 返回字符串数组 C#
- python - 在 GA+NN 中进行儿童培训期间实施“家长帮助/反馈”的最佳方式
- wso2 - activemq jms 故障转移传输的 wso2 内联配置
- templates - 有没有办法在编译器警告消息中获取模板类型的类型名?
- vba - 在 Gmail 中发送之前使用 VBA 将电子邮件保存到草稿或显示