del /q "C:\Users\John Cena\Desktop\YT\*"

I am creating a batch file. The above command permanently deletes all the files of a particular folder. But I don't want to delete the files permanently. I am looking for an alternative of "del" command which will help me to delete the files to recycle bin so that if I need any deleted file I can restore that from recycle bin.

  • Normally a batch file should know that files can be permanently deleted. Try solution 2 in the article below to move to recycle bin: codeproject.com/Questions/520260/…
    – John
    Nov 16, 2019 at 16:17

1 Answer 1


This is not possible using the del command.

You could use PowerShell for that.

You need first to start the PowerShell command prompt as Administrator and run the following:

Install-Module -Name Recycle

From now on you may include the following line in any batch file, without the need to run as Administrator:

powershell "Remove-ItemSafely 'C:\Users\John Cena\Desktop\YT\*'" -Force

The parameter -Force is to avoid the prompt for permission to delete.

  • The user who will run the batch file will not have administrative privilege. Nov 17, 2019 at 2:59
  • 1
    Admin permissions are only required once during the installation of the Recycle module. Its subsequent usage does not require any special permissions.
    – harrymc
    Nov 17, 2019 at 7:27

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .