Windows Guides Feed

The Windows Disk Cleanup Wizard will delete your temporary files, but only if they are over a week old. In this guide you will learn how to create a simple batch script that will clean up your temporary directory.

Create the Batch File

Open Notepad and type the following:

cd C:\Users\%username%\AppData\Local
rmdir /S /Q Temp

Automatically Delete Temporary Files in Windows Vista

Save the file as cleantemp.bat

Automatically Delete Temporary Files in Windows Vista

Now double click on the file to remove your temporary files and free up space on your computer.

If this doesn’t work and gives an access error, try replacing %username% with you windows login username.

Automate the Process

You can automate this process by right clicking on the file and selecting create shortcut.

Automatically Delete Temporary Files in Windows Vista

Now place the shortcut in your startup folder in the start menu. Now when you log in to Windows Vista, your temporary files will be deleted.

Automatically Delete Temporary Files in Windows Vista



About Rich

Rich is the owner and creator of Windows Guides; he spends his time breaking things on his PC so he can write how-to guides to fix the problems he creates.

Free PC tips by email

Search Windows Guides




Comments

31 thoughts on “Automatically Delete Temporary Files in Windows Vista”

  1. James says:

    Good tip – works just fine for me.

  2. James says:

    Good tip – works just fine for me.

  3. James says:

    Good tip – works just fine for me.

  4. Mike says:

    Hey Rich, I tried this and when I tried to run it, the window popped up but it said “Access is denied” a couple times in the dialogue. Did I do something wrong?

  5. Mike says:

    Hey Rich, I tried this and when I tried to run it, the window popped up but it said “Access is denied” a couple times in the dialogue. Did I do something wrong?

  6. Mike says:

    Hey Rich, I tried this and when I tried to run it, the window popped up but it said “Access is denied” a couple times in the dialogue. Did I do something wrong?

  7. Rich says:

    Replace %user_name% with your windows user name.

    If that doesn’t work, try right clicking the file and choosing “Run as Administrator…” Let me know if that works…

  8. Rich says:

    Replace %user_name% with your windows user name.

    If that doesn’t work, try right clicking the file and choosing “Run as Administrator…” Let me know if that works…

  9. Rich says:

    Replace %user_name% with your windows user name.

    If that doesn’t work, try right clicking the file and choosing “Run as Administrator…” Let me know if that works…

  10. Roberto says:

    Thanks!

  11. Roberto says:

    Thanks!

  12. Rommel says:

    works great!
    thanks

  13. Rommel says:

    works great!
    thanks

  14. Rommel says:

    works great!
    thanks

  15. Andrei says:

    It does not works for me:(

  16. Andrei says:

    It does not works for me:(

  17. Andrei says:

    It does not works for me:(

  18. Rich says:

    Andrei, where are you having problems?

  19. Rich says:

    Andrei, where are you having problems?

  20. Rich says:

    Andrei, where are you having problems?

  21. mrogi says:

    I get this error message:
    “The process cannot access the file because it is being used by another process.”

  22. mrogi says:

    I get this error message:
    “The process cannot access the file because it is being used by another process.”

  23. mrogi says:

    I get this error message:
    “The process cannot access the file because it is being used by another process.”

  24. edward says:

    how will i know if its work?? i cant see it. thanks

  25. edward says:

    how will i know if its work?? i cant see it. thanks

  26. edward says:

    how will i know if its work?? i cant see it. thanks

  27. snoxd says:

    Good tip, thanks :)

  28. snoxd says:

    Good tip, thanks :)

  29. snoxd says:

    Good tip, thanks :)

  30. Automatically Delete Temporary says:

    […] The Windows Disk Cleanup Wizard will delete your temporary files, but only if they are over a week old. To create a simple batch script that will clean up your temporary directories, do the following (Vista instructions): […]

  31. Guest says:

    Great !!! 10x :)

Comments are closed.


Computer tips in your inbox
Sign up for the Windows Guides newsletter to get PC tips and access to free Windows books (More details)

Enter your email address:
 

Popular Guides

See which sites have been visited on your PC (even if private browsing mode is used)

Create a Windows 7 System Repair Disc

Best Free Anti-malware

Hibernate vs. Sleep vs. Shut-Down

i3, i5, and i7; Dual, Quad, Hexa Core Processors. How to they Differ?

Intel's Ivy Bridge Processor: new Features

Submit Your Tip
Submit your computer tip to us; receive full credit for all published tips

Windows Guides on Facebook