Velvet Star Monitor

Standout celebrity highlights with iconic style.

updates

Powershell throw error on deleting a directory

Writer Olivia Zamora

I am trying to delete a large size directory using the following command: ( rajkaml is folder name )

rmdir /s /q rajkamal

But 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.RemoveItemCommand

How 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.

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy