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. Ok… Back to the writing agenda…
When holidays come and it’s a good to clean up your computer or smart phone – anything electrical – and dust on the wires too – but about that on some other occasion.
Today I ran on this article on how to create 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 you need them.
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.
*Command Prompt has almost every Windows OS in default programs
C:\Users\User> cd %tmp%
C:\Users\User\AppData\Local\Temp> cd %temp%
… and command prompt then lists folder files and size in temp folder under profile User in my case it’s Alex.
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
then you save file with name:
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:
Hope you enjoyed this entry and little hint: files will not wait for you in recycle bin!
Lot’s of love!
Credits for the batch file recipe go to one of the awesome guys at PC World: Lincoln Spector