domingo, setembro 27, 2026
Increva-se
Inicio English How to Clean Windows and Remove Junk Files With One Script

How to Clean Windows and Remove Junk Files With One Script

A tiny script can turn a sluggish computer into a fast machine — and even become a real source of income as a maintenance service.

por tecnologiaxt
Windows ⏱ 9 min read 📅 September 2026

How to Clean Windows and Remove Junk Files With One Script

A tiny script can turn a sluggish computer into a fast machine — and even become a real source of income as a maintenance service.

RC
Let’s clean Windows for free with a six-line script, automate it and see how this simple skill can become a service. I’m Ronaldo Cardoso from Tecnologia Moderna — technical, honest and always free content.
Quick summary

A six-line script cleans Windows for free — and can even become a paid service:

  • Always create a restore point before running maintenance scripts.
  • The limpeza.bat script removes only temporary files — documents and passwords are not touched.
  • Configure Disk Cleanup once with cleanmgr /sageset:1 so the script knows what to clean.
  • Automate it with Task Scheduler so it runs by itself every week.
  • It can become a paid service: cleaning, optimisation and recurring monthly maintenance.
Maintenance & extra income

🧹 Clean Windows With One Script

If your computer is slow, freezing or taking ages to open things, part of the problem is often digital junk: temporary files left behind by installers, updates, browsers and programs that never clean up after themselves. Over months, that can add up to several gigabytes.

In this guide you’ll create a small script that removes that junk in seconds, schedule it to run by itself every week — and, if you want, turn this knowledge into a maintenance service for other people.

Clean workspace with a laptop
The script only touches temporary folders and Windows’ own Disk Cleanup. Your documents, photos, saved passwords and browser data stay exactly where they are.
Publicidade
Before you start

⚠️ Create a Restore Point

Before running any maintenance script on Windows, I recommend a professional habit: create a system restore point. It lets you roll back Windows settings if anything unexpected happens.

how to create the restore point
1. Press Windows + R
2. Type: SystemPropertiesProtection
3. Select the Windows drive (usually C:)
4. Click Create
5. Give it a name such as: Before_Windows_cleanup
6. Wait for it to finish

This habit is what separates an amateur from a professional: any script can, in theory, interact in an unexpected way with a specific setup (custom drivers, group policies, manually changed permissions). The restore point is your free safety net — it takes under two minutes and can save hours of headaches.

If “Create” is greyed out, System Protection is off for that drive. Click Configure → Turn on system protection → OK, then create the point.
Part 1

🧹 Cleaning in Practice

Here is the script. Open Notepad, paste the code, save it as limpeza.bat (in “Save as type”, choose “All files”) and run it as administrator:

limpeza.bat
@echo off
echo Cleaning temporary files...
del /s /f /q %temp%\*
del /s /f /q C:\Windows\Temp\*
cleanmgr /sagerun:1
echo Done!
pause
Text editor with a small script

Some files will show “access denied” or “in use” while the script runs. That’s normal: they belong to programs that are open right now, and Windows protects them. The script simply skips them and moves on.

Tip: this already removes useless files and improves responsiveness without installing anything.
The step most tutorials forget

⚙️ Configure the Disk Cleanup Profile Once

The line cleanmgr /sagerun:1 runs Disk Cleanup using a saved profile number 1. But that profile has to exist first — otherwise Disk Cleanup has nothing selected to clean. Create it once:

  1. Open the Start menu, type cmd, right-click it and choose Run as administrator.
  2. Type cleanmgr /sageset:1 and press Enter.
  3. In the window that opens, tick what you want cleaned (Temporary files, Delivery Optimization files, Recycle Bin, Windows Update Cleanup…).
  4. Click OK. From now on, /sagerun:1 always uses these choices.
Think before ticking “Downloads” or “Recycle Bin”: anything there will be deleted every time the script runs. If you keep files in Downloads, leave that box unticked.
Publicidade
Understand what runs on your PC

🔍 What Each Line of the Script Does

LineWhat it does
@echo off Hides each command as it runs, keeping the output clean.
del /s /f /q %temp%\* Deletes the current user’s temporary folder contents — recursively through subfolders (/s), forced even on read-only files (/f) and without asking for confirmation (/q).
del /s /f /q C:\Windows\Temp\* Same logic, but in the system’s own temporary folder.
cleanmgr /sagerun:1 Runs Windows’ built-in Disk Cleanup with the profile you configured, automating what would normally take several clicks.
pause Keeps the window open at the end so you can read “Done!” before it closes.

Understanding each line matters twice over: you can trust what’s running on your machine, and you can explain it to a customer if you decide to offer this as a service.

Part 2

🔥 Automation

Most people stop here: they run the script once, feel the improvement and forget it exists. Months later the junk is back. Automating solves that at the root:

  1. Open Task Scheduler from the Start menu
  2. Click Create Task (not “Basic Task”)
  3. On the General tab, tick Run with highest privileges
  4. On the Triggers tab, choose Weekly — for example Monday morning
  5. On the Actions tab, choose “Start a program” and point it to limpeza.bat
Calendar representing a weekly routine

For the scheduled version, remove the pause line from a copy of the script — otherwise the window will sit there waiting for a key press that never comes.

Result: your PC stays clean automatically, without depending on your memory or discipline.
Part 3

💰 Turning It Into Income

This isn’t just a script — it’s the core of a service. You can offer cleaning, optimisation, monthly maintenance and remote support. With a handful of customers you already have recurring income.

“But if the script is free, why would anyone pay?” Because most people — especially those who aren’t comfortable with technology — don’t know it exists, don’t trust running a .bat file, and don’t have time to configure Task Scheduler. You’re not selling the script: you’re selling peace of mind, time saved and technical trust.

Technician helping a customer with a computer
Basic toolRole in the service
Cleaning script (.bat)The technical core of the service, free and open.
AnyDesk or TeamViewerRemote access, so you don’t need to travel.
Health report (PowerShell / HWiNFO)A before-and-after report proving the value delivered.
A simple spreadsheetTo track which customers got their monthly maintenance and when the next one is due.
Be transparent about what the service does (temporary file cleanup and basic optimisation) and what it doesn’t (it’s not an antivirus, doesn’t recover deleted files and doesn’t fix faulty hardware). Clarity prevents disappointment.
Publicidade
Structuring the service

📋 Packaging and Pricing

  • Define a clear package: for example “Monthly Preventive Maintenance” with temporary file cleanup, disk space check and a quick system health check.
  • Document before and after: a screenshot of the space freed or the boot time before and after is far more convincing than “I cleaned your PC”.
  • Charge for the value delivered, not just the time: a PC that’s fast again can be worth much more to the customer than the minutes the remote session took.
  • Offer a recurring plan: a fixed monthly package is more attractive to the customer (predictable cost) and better for you (predictable income).
  • Start with entry prices to build a portfolio: first customers generate testimonials and referrals, which are worth more in the long run.
Going further

🧰 Other Maintenance That Pairs With This Script

Troubleshooting

🔧 Common Errors When Running the Script

ErrorWhat to do
“Access denied” when runningThe file wasn’t run as administrator. Right-click the .bat and choose “Run as administrator”.
Windows SmartScreen blocks itNormal for .bat files downloaded from the internet. Open the file in Notepad, check the content, then click “More info” → “Run anyway”.
The window closes before I can read the resultMake sure the “pause” line is at the end of the script.
cleanmgr doesn’t open any windowExpected — with /sagerun it runs silently in the background.
Almost nothing was freedCheck that you created the profile with cleanmgr /sageset:1 and ticked the categories.
Frequently Asked Questions

FAQ

Does the script delete personal files like photos and documents?

No. It only acts on temporary folders (%temp% and C:\Windows\Temp) and Windows’ built-in Disk Cleanup. Documents, photos and saved passwords are not affected — just be careful not to tick “Downloads” in the Disk Cleanup profile if you keep files there.

Why create a restore point before running the script?

It’s an extra professional safety layer: if anything turns out differently than expected, you can roll the system settings back quickly.

How do I make the script run automatically every week?

Use Task Scheduler: create a task with “Run with highest privileges”, a weekly trigger, and an action pointing to limpeza.bat.

Do I need to know programming to use it?

No. Copy the code exactly as it is, paste it into Notepad, save it with the .bat extension and run it as administrator.

Can you really earn money offering this kind of service?

Yes, it’s a real IT maintenance service. The key is packaging the offer well (cleaning + optimisation + recurring maintenance) and getting the first customers through referrals or social media.

SmartScreen blocked my script — is it a virus?

Not necessarily. It’s Windows’ default behaviour for any .bat downloaded from the internet. Open it in Notepad and review the content before allowing it to run.

Test your knowledge

🎮 How much did you learn?

Once you pick an answer it locks in — reload the page to try again.

1. What does “del /s /f /q %temp%\*” do in the script?

2. Why create a restore point before running the cleanup script?

3. What must you run once so cleanmgr /sagerun:1 knows what to clean?

4. How do you automate the script every week?

5. According to the article, how can this skill become income?

Compartilhar

Esse conteúdo ajudou você?

Compartilha com alguém que também vai curtir — é rapidinho e ajuda muito o nosso trabalho a chegar em mais gente.

WhatsApp Facebook Telegram X

O Instagram não tem um botão de compartilhar direto pelo navegador — copie o link acima e cole numa Story ou no direct. 😉

Siga a Gente

Não perca nenhuma dica

Conteúdo novo toda semana — direto, técnico e sem enrolação.

Conhecimento só tem valor quando compartilhado.

Manter essa estrutura de laboratórios funcionando e produzir conteúdos de engenharia de forma totalmente gratuita e acessível exige tempo e dedicação diária à bancada. Esse guia salvou os seus arquivos? Você pode contribuir diretamente para manter o nosso trabalho independente forte. Apoie doando qualquer valor!

Quer apoiar a nossa bancada independente?

Tecnologia Moderna © 2026 — Conteúdo escrito por Ronaldo Cardoso. Todas as informações técnicas foram revisadas antes da publicação.

Fique Por Dentro de todas as Novidades

Canal com propósito de Compartilhar, Ajudar e Ampliar conhecimento de todos!

📬

Ronaldo aqui: E aí, para não perder nenhum conteúdo, se inscreva aqui que eu aviso você em primeira mão!

Nos Envie a Sua Dúvida para que possamos criar um conteúdo exclusivo para você, com base na sua dúvida! juntos podemos ensinar outras pessoas!

@2024 – Todos os Direitos Reservado. Desenhado e Desenvolvido por:  Grupo Interativa Marketing  & Technology Center Interativa Marketing