How to Empty Recycle Bin Automatically while Signing out on Windows 11/10?

Posted by

Do you want to clean Recycle Bin automatically while signing out on Windows 11/10? In this gearupwindows article, we will guide you to do so.

If you frequently delete the files or folders and forget to empty the Recycle Bin, it may occupy a lot of space on your PC. Recycle Bin works like a safety net, and every time you delete any file or folder from your PC, Recycle bin stores it so that you can restore those files whenever you want. That means, after deleting a file/folder also, until you have emptied the Recycle Bin, you can recover them.

But, when you delete many files and want to keep the recycle bin clean without any intervention, you can configure your Windows 11/10 to empty the recycle bin when signing out from your PC. That means, when you restart or sign in again on your PC, all the files and folders from the recycle bin will be deleted automatically. You don’t need to empty the recycle Bin manually.

Microsoft had introduced the Storage sense feature on Windows 10 and is also available on Windows 11 to automatically empty the recycle bin. But, this storage sense feature does not allow you to clean your Recycle Bin folder automatically after signing out from your Windows. Let us take one more example. Suppose you maintain a cyber cafe where you want to keep your PC clean by emptying the recycle bin when a user leaves your PC. You can manually empty the recycle bin if you wish to or leave a script to clean the recycle bin automatically. If you forget to empty the recycle bin, still your PC will empty the recycle bin when you log off your PC.

To empty the recycle bin automatically, we will not go through lengthy steps, which means we will use a simple script, that will automatically run and clean your recycle bin.

How to Empty Recycle Bin Automatically while Signing out from Windows 11/10?

Step 1. Press Windows + R keys from the keyboard to open the Run dialog box.

Step 2. Type notepad in the Run box and press Enter from the keyboard.

Step 3. In the Notepad window that opens, copy and paste the following texts:-

PowerShell.exe -NoProfile -Command Clear-RecycleBin -Confirm:$false

Step 4. Click on the File menu and select Save as option.

Step 5. Select the file’s location in the “Save as” dialog to save this batch file. Next,  Type the file name as “Empty Recycle Bin.bat.” Now, choose the All Files option from the “Save as type” drop-down. Finally, click on the Save button.

Once you complete the above steps, you will see a file named “Empty Recycle Bin.bat” in the specified location. You can empty the recycle bin by double-clicking on this batch file, but your purpose is not solved. So, you need to do some steps.

Step 6. Open the Group Policy Editor.

Step 7. From the left sidebar, navigate to the following path:-

Computer Configuration > Windows Settings > Scripts (Startup/Shutdown)

Step 8. On the right side pane of the Scripts (Startup/Shutdown), double-click on the Shutdown policy.

Step 9. Click on the Add button.

Step 10. In the pop-up window, click on the Browse and select the batch file you have created in the above steps.

Step 11. Click OK.

Step 12. Click Apply then OK.

That’s it. Now, this script will automatically run whenever you shut down your PC. That means your recycle bin will automatically be emptied when you shut down your PC.

Leave a Reply

Your email address will not be published. Required fields are marked *