Close Menu
TechurzTechurz

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    I tried the Meta Ray-Ban Display glasses, and this unreleased feature changes everything

    October 20, 2025

    Fire TV acting slow? 10 settings I changed on mine to instantly improve the performance

    October 19, 2025

    I tested a $2,000 medical tablet for research, and it turned out to be a Windows beast

    October 19, 2025
    Facebook X (Twitter) Instagram
    Trending
    • I tried the Meta Ray-Ban Display glasses, and this unreleased feature changes everything
    • Fire TV acting slow? 10 settings I changed on mine to instantly improve the performance
    • I tested a $2,000 medical tablet for research, and it turned out to be a Windows beast
    • I found a cheap Windows laptop that I’d actually use for work travel – and it’s on sale
    • How you’re charging your tablet is slowly killing it – 3 ways to avoid (and the right method)
    • Europol Dismantles SIM Farm Network Powering 49 Million Fake Accounts Worldwide
    • Are high-end Windows laptops worth buying? I tested one from Dell, and it made a statement
    • Walmart is selling a $99 Samsung smartwatch that I actually highly recommend
    Facebook X (Twitter) Instagram Pinterest Vimeo
    TechurzTechurz
    • Home
    • AI
    • Apps
    • News
    • Guides
    • Opinion
    • Reviews
    • Security
    • Startups
    TechurzTechurz
    Home»Guides»How to Automatically Clear Temporary Files on Windows 11
    Guides

    How to Automatically Clear Temporary Files on Windows 11

    TechurzBy TechurzJune 5, 2025No Comments5 Mins Read
    Share Facebook Twitter Pinterest LinkedIn Tumblr Reddit Telegram Email
    How to Automatically Clear Temporary Files on Windows 11
    Share
    Facebook Twitter LinkedIn Pinterest Email


    Windows 11 accumulates many temporary files over time. One way to get rid of these files is to manually delete them. If you don’t want that hassle, you can automate the process. I’ll show you how.

    Step 1: Create a Script to Clear Temporary Files

    To automatically remove temporary files on your Windows 11 PC, you’ll create a script. This script removes the temporary files from your user account’s temporary folder as well as the system-wide temporary folder.

    To do that, access Windows Search (press Windows+S), type Notepad, and launch the app. Type the following code in a new Notepad document:

    @echo off
    echo Cleaning system and user temp files…
    del /s /f /q %TEMP%\*.* >nul 2>&1
    rd /s /q %TEMP% >nul 2>&1
    md %TEMP%

    del /s /f /q C:\Windows\Temp\*.* >nul 2>&1
    rd /s /q C:\Windows\Temp >nul 2>&1
    md C:\Windows\Temp

    echo Temporary files cleared!

    To save the script, from Notepad’s menu bar, choose File > Save As. Select the folder where you want to save the script. Click the “Save as Type” drop-down menu and choose “All Files.” Click the “File Name” field and type ClearTempFiles.bat (the bat extension indicates it’s a batch file).

    Step 2: Schedule the Script With Task Scheduler

    Your script is ready. You’ll now schedule it with Task Scheduler so it runs at the specified interval, automatically clearing your PC’s temporary files. To do that, open Windows Search (press Windows+S), type Task Scheduler, and launch the utility.

    Related

    You’re Not Making the Most of Task Scheduler in Windows

    Save time by automating tasks!

    In Task Scheduler’s right sidebar, click “Create Basic Task.” Choose the “Name” field and type something like Clear Temporary Files. Then, select “Next.”

    Select how often you want to run your script. To clear the temporary files every day, select “Daily.” Then, click “Next.”

    Choose the “Start” field and select the date when the task should start occurring. Specify the time the task should run. Then, click “Next.”

    Choose “Start a Program” and select “Next.” Click the “Program/Script” field and type the full path to the script you created earlier. Then, click “Next.”

    On the final screen, enable the “Open the Properties Dialog For This Task When I click Finish” option. Then, click “Finish.” On the open window, at the bottom, turn on the “Run With Highest Privileges” option. Then, click “OK.”

    From now on, Task Scheduler will automatically run your script at the specified time, clearing temporary files.

    If you want to turn off the functionality anytime, right-click your task in Task Scheduler and choose “Disable. To remove the task for good, right-click it and choose “Delete.”

    Add More Cleanup Options to the Script

    The script you created above only clears temporary files on your Windows 11 PC. If you want to clear other files, add the following extensions to your script.

    Related

    How to Clear Your Cache on Windows 11

    Let go of unnecessary files and free up some storage space!

    To make your script clear the contents of Recycle Bin as well, add the following code to the script:

    PowerShell.exe -Command “Clear-RecycleBin -Force”

    To make the script clear the Windows Update cache, add the following code to your script file:

    net stop wuauserv
    rd /s /q C:\Windows\SoftwareDistribution\Download
    net start wuauserv

    You can clear pretech files using the following code:

    del /s /f /q C:\Windows\Prefetch\*.* >nul 2>&1

    Tip: Run the Script at the Start or Shutdown of Your PC

    You can get Windows 11 to run your script when you turn off or on your PC.

    To make the script run at the start of your PC, open Task Scheduler. Right-click your task and choose “Properties.” Open the “Triggers” tab and click “New.” Select the “Begin the Task” drop-down menu and choose “At Startup.” At the bottom, select “OK.” Choose “OK” to save your changes.

    To make the run script run at the shutdown of your PC, you’ll use Local Group Policy Editor on your Windows 11 Pro edition. This utility isn’t available in the Home edition. To start, open Run by pressing Windows+R, type gpedit.msc, and press Enter. Navigate to Computer Configuration > Windows Settings > Scripts (Startup/Shutdown) and double-click “Shutdown” on the right. Select “Add,” add your script file, and save the changes.

    Use Storage Sense to Clear Temporary Files

    Windows 11 includes a feature called Storage Sense that can help you get rid of temporary files from your PC. This feature isn’t as flexible as the script above, though.

    Related

    How to Free Up Space in Windows 11

    Windows 11 includes tools to free up space that make third party cleaners irrelevant. Find out how to use them here.

    To use it, open Settings by pressing Windows+i. From the left sidebar, choose “System.” On the right pane, select “Storage.” Turn on the “Storage Sense” toggle and click “Storage Sense.”

    On the open screen, specify what and when you want to delete. Use the “Run Storage Sense” drop-down menu to choose when you want the feature to kick in.

    And that’s how you automate the process of removing junk files from your Windows 11 PC. Similarly, you can find and remove old files as well to declutter your machine.

    automatically Clear Files Temporary Windows
    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Previous ArticleRippling calls Deel ‘a criminal syndicate’ and claims 4 other competitors were spied on, too
    Next Article Google CEO Sundar Pichai Is ‘Vibe Coding’ a Website for Fun
    Techurz
    • Website

    Related Posts

    Security

    I tested a $2,000 medical tablet for research, and it turned out to be a Windows beast

    October 19, 2025
    Security

    I found a cheap Windows laptop that I’d actually use for work travel – and it’s on sale

    October 19, 2025
    Security

    Are high-end Windows laptops worth buying? I tested one from Dell, and it made a statement

    October 19, 2025
    Add A Comment
    Leave A Reply Cancel Reply

    Top Posts

    The Reason Murderbot’s Tone Feels Off

    May 14, 20259 Views

    A Former Apple Luminary Sets Out to Create the Ultimate GPU Software

    September 25, 20258 Views

    Start Saving Now: An iPhone 17 Pro Price Hike Is Likely, Says New Report

    August 17, 20258 Views
    Stay In Touch
    • Facebook
    • YouTube
    • TikTok
    • WhatsApp
    • Twitter
    • Instagram
    Latest Reviews

    Subscribe to Updates

    Get the latest tech news from FooBar about tech, design and biz.

    Most Popular

    The Reason Murderbot’s Tone Feels Off

    May 14, 20259 Views

    A Former Apple Luminary Sets Out to Create the Ultimate GPU Software

    September 25, 20258 Views

    Start Saving Now: An iPhone 17 Pro Price Hike Is Likely, Says New Report

    August 17, 20258 Views
    Our Picks

    I tried the Meta Ray-Ban Display glasses, and this unreleased feature changes everything

    October 20, 2025

    Fire TV acting slow? 10 settings I changed on mine to instantly improve the performance

    October 19, 2025

    I tested a $2,000 medical tablet for research, and it turned out to be a Windows beast

    October 19, 2025

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    Facebook X (Twitter) Instagram Pinterest
    • About Us
    • Contact Us
    • Privacy Policy
    • Terms and Conditions
    • Disclaimer
    © 2025 techurz. Designed by Pro.

    Type above and press Enter to search. Press Esc to cancel.