{"id":3922,"date":"2016-08-31T14:27:58","date_gmt":"2016-08-31T08:57:58","guid":{"rendered":"http:\/\/198.58.113.91\/blog\/?p=3922"},"modified":"2019-07-13T11:25:37","modified_gmt":"2019-07-13T11:25:37","slug":"empty-recycle-bin-task-scheduler-powershell-clear-recyclebin-nircmd","status":"publish","type":"post","link":"https:\/\/www.winhelponline.com\/blog\/empty-recycle-bin-task-scheduler-powershell-clear-recyclebin-nircmd\/","title":{"rendered":"Empty Recycle Bin Automatically Using Task Scheduler or Storage Sense"},"content":{"rendered":"<p>You can use it to clear the Recycle Bin at a specified time or regular intervals with Task Scheduler using a PowerShell command. Alternately, you can also use Storage Settings (a.k.a. <a href=\"https:\/\/www.winhelponline.com\/blog\/storage-app-find-files-taking-disk-space-w10\/\">Storage Sense<\/a>) to clear the files from Recycle Bin that are older than a certain number of days.<\/p>\n<p>This article discusses the two methods to clear the Recycle Bin automatically at predefined intervals.<!--more--><\/p>\n<h2>How to Automatically Empty the Recycle Bin in Windows 10<\/h2>\n<h3>Method 1: Using Storage Sense<\/h3>\n<p>The Windows 10 <a href=\"https:\/\/www.winhelponline.com\/blog\/automatically-clear-temp-files-every-login-using-disk-cleanup-batch-file\/#storage_sense\">Storage Settings<\/a> has a feature which lets you delete files in the Recycle Bin that are older than &#8220;x&#8221; days.<\/p>\n<ol>\n<li>Open Settings, System, Storage<\/li>\n<li>Enable the radio-button near the option &#8220;Storage can automatically free up space&#8230;&#8221; under Storage.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10324\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/08\/storage-settings-cleanup-enable.png\" alt=\"empty recycle bin - storage settings or storage sense\" width=\"700\" height=\"270\" \/><\/li>\n<li>Click <strong>Configure Storage Settings or run now<\/strong>. This opens the configuration page where you can choose the items you want to automatically delete using Storage Sense.<\/li>\n<li>Under <strong>Delete files in my Recycle Bin if they have been there for over<\/strong>, choose one of the options listed. In Windows 10 v1903, this option provides you 5 choices, namely: &#8220;Never&#8221;, &#8220;1 day&#8221;, &#8220;14 days&#8221;, &#8220;30 days&#8221;, &#8220;60 days&#8221;. Choose one of the options as required.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-10323\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/08\/storage-settings-cleanup-recycle-bin.png\" alt=\"empty recycle bin - storage settings or storage sense\" width=\"700\" height=\"444\" \/><\/li>\n<\/ol>\n<p>That&#8217;s it. The Storage Sense will automatically delete older files in your Recycle Bin.<\/p>\n<div class=\"rp\"><strong>RELATED:<\/strong> <a href=\"https:\/\/www.winhelponline.com\/blog\/delete-unused-files-older-than-x-days-windows\/\">How to Delete Files Older than N Days Automatically in Windows<\/a><\/div>\n<h3>Method 2: Using a PowerShell command with Task Scheduler<\/h3>\n<p>As you know, PowerShell has a built-in cmdlet to <a href=\"https:\/\/www.winhelponline.com\/blog\/empty-recycle-bin-single-click-using-powershell\/\">clear the Recycle Bin automatically<\/a> using the following command, which you can also automate with Task Scheduler.<\/p>\n<pre>powershell.exe -command Clear-RecycleBin -Force<\/pre>\n<p>Running <code>PowerShell.exe<\/code> from Task Scheduler would display the PowerShell window every time the task runs. To avoid that, you can run the above command in <a href=\"https:\/\/www.winhelponline.com\/blog\/run-bat-files-invisibly-without-displaying-command-prompt\/\">hidden mode<\/a> by launching it with a VBScript.<\/p>\n<ol>\n<li>Create a VBScript from the following contents. To do so, copy the following contents to Notepad and save the file with .vbs extension &#8212; e.g. <code>EmptyBin.vbs<\/code>\n<pre>Set WshShell = WScript.CreateObject(\"WScript.Shell\")\r\nWshShell.Run \"powershell.exe\" &amp; \" -command Clear-RecycleBin -Force\", 0, 0\r\nSet WshShell = Nothing<\/pre>\n<p>Optionally, you may move the VBScript file to your Windows directory if required. The next step is to create a scheduled task to run the above script to empty the Recycle Bin at required intervals.<\/li>\n<li>Open Task Scheduler, and click <strong>Create a Task&#8230;<\/strong> in the Actions pane.<\/li>\n<li>Type the name of the task and assign a description.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3923\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/08\/empty-bin-scheduler-1.png\" alt=\"empty recycle bin task scheduler\" width=\"632\" height=\"480\" \/><\/li>\n<li>Click the Triggers tab, and click New.<\/li>\n<li>In the &#8220;Begin the task:&#8221; drop-down box, select an option from the list. In this example, I chose to run the task <strong>At log on<\/strong>, by any user in the system.<br \/>\n<img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3925\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/08\/empty-bin-scheduler-2.png\" alt=\"empty recycle bin task scheduler\" width=\"591\" height=\"516\" \/><\/li>\n<li>Click OK. Select the Actions tab, and click New<\/li>\n<li>In the Program\/Script: text box, type the following:\n<pre>C:\\Windows\\System32\\Wscript.exe<\/pre>\n<\/li>\n<li>In the Add arguments (optional): text box, type:\n<pre>C:\\Windows\\EmptyBin.vbs<\/pre>\n<p><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-3924\" src=\"https:\/\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/08\/empty-bin-scheduler-3.png\" alt=\"empty recycle bin task scheduler\" width=\"454\" height=\"500\" \/><\/li>\n<li>Click OK, OK.<\/li>\n<\/ol>\n<p>That&#8217;s all. The Recycle Bin should be cleared automatically at every log on, or at the specific time intervals if you&#8217;ve set any.<\/p>\n<div class=\"rp\"><strong>RELATED:<\/strong> <a href=\"https:\/\/www.winhelponline.com\/blog\/disable-empty-recycle-bin-confirmation-windows\/\">Empty the Recycle Bin Without Confirmation Prompt (Using NirCmd)<\/a><\/div>\n<p><i><strong>Note:<\/strong> Earlier versions of PowerShell don&#8217;t include the <a href=\"https:\/\/www.winhelponline.com\/blog\/empty-recycle-bin-single-click-using-powershell\/\">Clear-RecycleBin<\/a> cmdlet. In that case, you may either upgrade PowerShell or use the excellent <a href=\"https:\/\/www.winhelponline.com\/blog\/?s=NirCmd\">NirCmd<\/a> command-line automation tool to <a href=\"https:\/\/www.winhelponline.com\/blog\/disable-empty-recycle-bin-confirmation-windows\/\">clear the Recycle Bin<\/a> silently.<\/i><\/p>\n","protected":false},"excerpt":{"rendered":"<p>You can use it to clear the Recycle Bin at a specified time or regular intervals with Task Scheduler using a PowerShell command. Alternately, you can also use Storage Settings (a.k.a. Storage Sense) to clear the files from Recycle Bin that are older than a certain number of days. This article discusses the two methods &#8230; <a title=\"Empty Recycle Bin Automatically Using Task Scheduler or Storage Sense\" class=\"read-more\" href=\"https:\/\/www.winhelponline.com\/blog\/empty-recycle-bin-task-scheduler-powershell-clear-recyclebin-nircmd\/\" aria-label=\"Read more about Empty Recycle Bin Automatically Using Task Scheduler or Storage Sense\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_feature_clip_id":0,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_post_was_ever_published":false},"categories":[7],"tags":[],"class_list":["post-3922","post","type-post","status-publish","format-standard","hentry","category-windows"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack-related-posts":[{"id":4640,"url":"https:\/\/www.winhelponline.com\/blog\/automatically-clear-temp-files-every-login-using-disk-cleanup-batch-file\/","url_meta":{"origin":3922,"position":0},"title":"Automatically Clear Temp Files Using Disk Cleanup, Storage Sense or Batch file","author":"Ramesh","date":"November 22, 2016","format":false,"excerpt":"The TEMP directory (%temp%) gets bloated over time as applications store data over there and don't always remove the files and folders they created. And, software installers extract the contents of the setup packages to the %temp% folder and fail to do the cleanup act when the installation is complete.\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"windows 10 storage settings cleanup options","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/11\/storage-settings-cleanup-options.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/11\/storage-settings-cleanup-options.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2016\/11\/storage-settings-cleanup-options.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":8555,"url":"https:\/\/www.winhelponline.com\/blog\/prevent-disk-cleanup-storage-sense-from-deleting-downloads\/","url_meta":{"origin":3922,"position":1},"title":"Stop Disk Cleanup and Storage Sense from Emptying your Downloads folder","author":"Ramesh","date":"April 8, 2019","format":false,"excerpt":"If you use Disk Cleanup, you will want to be aware of a change to its options since the October 2018 feature update (v1809). Disk Cleanup, now also has the option to delete the contents of your Downloads folder. However, many users like to use the Downloads folder as permanent\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"disk cleanup remove downloads option","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/04\/disk-cleanup-downloads-folder-2.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":306,"url":"https:\/\/www.winhelponline.com\/blog\/fix-corrupted-recycle-bin-windows-vista-7-8-10\/","url_meta":{"origin":3922,"position":2},"title":"How to Fix the Corrupted Recycle Bin Store Folder","author":"Ramesh","date":"May 28, 2008","format":false,"excerpt":"There are situations where you need to reset the Recycle Bin store folder to fix problems such as Recycle Bin not showing the files that have been deleted. In some cases, you may be unable to completely empty the Recycle Bin. Each drive has a hidden and protected folder named\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"recycle bin store folder","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2008\/05\/recycle-bin-store-folder.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1075,"url":"https:\/\/www.winhelponline.com\/blog\/fix-recycle-bin-icon-not-refresh-custom-icons-windows-7\/","url_meta":{"origin":3922,"position":3},"title":"[Fix] Recycle Bin Icon Does Not Refresh Correctly","author":"Ramesh","date":"August 29, 2009","format":false,"excerpt":"When you use a custom icon (.ico) file to customize the Recycle Bin Empty & Full icons manually or via a desktop theme, the Recycle Bin icon may not update or refresh correctly when emptying the Recycle Bin or when you add items to it. In some cases, the issue\u2026","rel":"","context":"In &quot;Windows&quot;","block_context":{"text":"Windows","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/"},"img":{"alt_text":"recycle bin does not refresh","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2009\/08\/w7-rbin-custicon-3.png?resize=350%2C200&ssl=1","width":350,"height":200},"classes":[]},{"id":1479,"url":"https:\/\/www.winhelponline.com\/blog\/storage-app-find-files-taking-disk-space-w10\/","url_meta":{"origin":3922,"position":4},"title":"Using Storage Settings to Find Files Consuming More Disk Space in Windows 10","author":"Ramesh","date":"January 23, 2016","format":false,"excerpt":"Is your hard drive showing up full, and wondering how to find the biggest consumers of disk space? It\u2019s probably the Disk Cleanup tool that comes to mind at this situation. While Disk Cleanup is an excellent utility, it lists items only from fixed locations, although fully serving the purpose\u2026","rel":"","context":"In &quot;Windows 10&quot;","block_context":{"text":"Windows 10","link":"https:\/\/www.winhelponline.com\/blog\/category\/microsoft\/windows\/windows-10\/"},"img":{"alt_text":"","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/w10\/w10-storage-1.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/w10\/w10-storage-1.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/w10\/w10-storage-1.png?resize=525%2C300&ssl=1 1.5x"},"classes":[]},{"id":10740,"url":"https:\/\/www.winhelponline.com\/blog\/free-up-hard-disk-space-windows\/","url_meta":{"origin":3922,"position":5},"title":"How to Free Up Gigabytes of Disk Space in Windows","author":"Ramesh","date":"August 18, 2019","format":false,"excerpt":"Windows 10 updates, especially the feature updates, consume enormous disk space as Windows stores the older copies in case you want to roll back to the previous version. Hard disk drives have become cheaper and affordable nowadays. A 1 TB SATA HDD costs less than $50. But, if you're using\u2026","rel":"","context":"In &quot;Utilities&quot;","block_context":{"text":"Utilities","link":"https:\/\/www.winhelponline.com\/blog\/category\/utilities\/"},"img":{"alt_text":"chrome cache localstorage service worker cache","src":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/08\/chrome-storage-dev-tools.png?resize=350%2C200&ssl=1","width":350,"height":200,"srcset":"https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/08\/chrome-storage-dev-tools.png?resize=350%2C200&ssl=1 1x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/08\/chrome-storage-dev-tools.png?resize=525%2C300&ssl=1 1.5x, https:\/\/i0.wp.com\/www.winhelponline.com\/blog\/wp-content\/uploads\/2019\/08\/chrome-storage-dev-tools.png?resize=700%2C400&ssl=1 2x"},"classes":[]}],"_links":{"self":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/3922","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/comments?post=3922"}],"version-history":[{"count":0,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/posts\/3922\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/media?parent=3922"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/categories?post=3922"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.winhelponline.com\/blog\/wp-json\/wp\/v2\/tags?post=3922"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}