Hello, World! Goodbye, temporary files!

It’s not a win, but it’s a start.

I’ve searched for fancy quote about beginning but I could not find the appropriate one. In today’s world where every Java developer owns a blog and every celebrity has a reality show it’s hard to conquer the media with good content. Or bulk content. I’m not here to judge. In the community of World Wide Web we can all live in some kind of harmony. Back to the writing agenda…

Sometimes holiday come and it’s a good day like on holiday for example to clean up your computer and smart phone – anything electrical – and dust on the wires too – but about that on some other event.

Today I ran on this article on how to creat a batch file to clean up the mess in your [temp] folder.

ABOUT TEMP FOLDER

Temp folder is default folder created by operating system – usually Windows – that contains all sorts of files created by random programs and even more random third-party programs.

You can also manually create [temp] folder – my friend had a habit to save installation .exe files in [temp] folder on C: for example – that’s a good thing because you don’t need to download programs every time. On Windows XP there was already that folder for default, I think in newer OS it usually needs to be created. It also depends if it’s temp folder under user profile or just on the C: where other system files are. If you create [temp] folder manually it will only contain files you put in the folder. There is slight difference between files and folder created by operating system or programs.

Ok, so why is good to clean [temp] folder in the first place?

As the Lincoln Spector said: “As the name implies, the temp folder contains files that are only needed temporally. Unfortunately, these files don’t always get deleted after their job is done, resulting in wasted drive space.

Since it takes like forever to manually delete the temporally files we can create a little batch file that does it for us every time we restart or turn on (after shutdown) computer.

A batch file or like Slovenians like to call it “batka” is command that executes before other programs or services start.

Or as doctors from Microsoft say:

A batch file is an unformatted text file that contains one or more commands and has a .bat or .cmd file name extension. When you type the file name at the command prompt, Cmd.exe runs the commands sequentially as they appear in the file. -> Source: Microsoft

VIEW FILES IN COMMAND PROMPT

Firstly before we go all: let’s delete everything party… It’s good to check first what kind of files and folders we have and how much space do they take.

Open CMD:

*Command Prompt has almost every Windows OS in default programs

C:\Users\User> cd %tmp%

C:\Users\User\AppData\Local\Temp> cd %temp%

C:\Users\User\AppData\Local\Temp> dir

… and command prompt then lists folder files and size in temp folder under profile User in my case it’s Alex.

temp1
Command prompt: cd %tmp% and cd %temp% and dir
temp2
Size of files in temp folders

Ok so here we have info what kind of files are and how much bytes do they take. You can also see that I have in my [temp] DIRectory mozilla-temp-files folder where Mozilla Firefox browser leaves temporary data.

CREATE BATCH FILE TO CLEAR TEMP FOLDER IN WINDOWS START UP

Secondly let’s open Notepad to create batch file or batka:

rd %temp% /s /q
md %temp%

then you save file with name:

%appdata%\microsoft\windows\start menu\programs\startup\cleantemp.bat

temp3
MS DOS commands in Notepad
temp4
Save as: the file name will automatically save file in Windows Startup

The batch file will run when operating system boots.

You can find batch file in Windows Start up if you go: run > msconfig

Or in windows 10 in Task Manager:

temp5.png
MS CONFIG is in Windows 10 Task Manager

Hope you enjoyed this entry and little hint: files will not wait for you in recycle bin!

Lot’s of love,

Alexa

Credits for the batch file recipe go to one of the awesome guys at PC World:

Source: How to clean your Windows Temp folder

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s