VS 代码终端无法在 windows 上执行删除文件夹的任务
VS code terminal cannot execute task for deleting a folder on windows
我正在尝试从 VS 代码任务中删除一个文件夹,该文件夹将 运行 一个 shell 命令。
我的任务如下所示:
{
"label": "Delete destination Folder",
"type": "shell",
"command": "rd",
"args": [
"C:\Program Files (x86)\<PATH TO MY FOLDER> ",
"/S",
"/Q"
],
"group": "build",
"presentation": {
"reveal": "silent",
"panel": "new"
}
当我尝试 运行 任务时出现此错误(我正在翻译错误消息,因此它可能并不完美):
Impossible to find a positional arguments that accepts '/S'.
In row:1 char:1
+ rd 'C:\Program Files (x86)\Apache Software Foundation\Apache2\htdocs\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-Item], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
终端是否将 RD 视为具有单个参数的命令?
我必须指定任务的另一个字段吗?
如果它对某人有用,我做到了 运行 Remove-item
,而不是 rd
(感谢提供答案的lit):
{
"label": "Delete destination Folder",
"type": "shell",
"command": "Remove-item",
"args": [
"C:\Program Files (x86)\Apache Software Foundation\Apache2\htdocs\webapps\FEmatrixovaiole",
"-recurse"
],
"group": "build",
"presentation": {
"reveal": "silent",
"panel": "new"
}
我正在尝试从 VS 代码任务中删除一个文件夹,该文件夹将 运行 一个 shell 命令。 我的任务如下所示:
{
"label": "Delete destination Folder",
"type": "shell",
"command": "rd",
"args": [
"C:\Program Files (x86)\<PATH TO MY FOLDER> ",
"/S",
"/Q"
],
"group": "build",
"presentation": {
"reveal": "silent",
"panel": "new"
}
当我尝试 运行 任务时出现此错误(我正在翻译错误消息,因此它可能并不完美):
Impossible to find a positional arguments that accepts '/S'.
In row:1 char:1
+ rd 'C:\Program Files (x86)\Apache Software Foundation\Apache2\htdocs\ ...
+ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : InvalidArgument: (:) [Remove-Item], ParameterBindingException
+ FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommand
终端是否将 RD 视为具有单个参数的命令? 我必须指定任务的另一个字段吗?
如果它对某人有用,我做到了 运行 Remove-item
,而不是 rd
(感谢提供答案的lit):
{
"label": "Delete destination Folder",
"type": "shell",
"command": "Remove-item",
"args": [
"C:\Program Files (x86)\Apache Software Foundation\Apache2\htdocs\webapps\FEmatrixovaiole",
"-recurse"
],
"group": "build",
"presentation": {
"reveal": "silent",
"panel": "new"
}