I'm trying to delete a folder from a VS code task that will run a shell command. My task looks like this:
{
"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"
}
When i try to run the task i get this error (i'm translating the error message, so it might not be perfect):
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
Does the terminal see RD like a command with a single argument? Do i have to specify another field of the task?
If it can be usefuel for somebody, i did it running Remove-item
, not rd
(Thanks to lit who provided the answer):
{
"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"
}