Powershell throw error on deleting a directory
Olivia Zamora
I am trying to delete a large size directory using the following command: ( rajkaml is folder name )
rmdir /s /q rajkamalBut getting error as :
Remove-Item : A positional parameter cannot be found that accepts argument '.\rajkamal'.
At line:1 char:6
+ rmdir <<<< /s/q .\rajkamal + CategoryInfo : InvalidArgument: (:) [Remove-Item], ParameterBindingException + FullyQualifiedErrorId : PositionalParameterNotFound,Microsoft.PowerShell.Commands.RemoveItemCommandHow to fix it? what is wrong with my command?
Thanks in advance.
1 Answer
If you're trying to run rmdir within PowerShell you're not running what you think you're running.
If you run rmdir -? you will see that it's just an alias to Remove-Item which doesn't support the switches you've used. If I'm not mistaken the equivalent would be Remove-Item -Recurse -Confirm:$false or depending on it a -Force instead of the confirm.