Monday, 24 June 2013

Extra Hard Disk Drive Space On Windows XP


I have recently been giving away some Home Made System Tools
That I use when working on Computers & Lap Tops...
This is stuff people just DON'T give away because they are their little home made tools of the trade, things that make us good, well make me good, ive watched many do this job by hand LMFAO

So today i share with the world my WindowsXPUpdateCleaner.bat
(see END of POST for Full Script)

This is a script of sorts written in windows notepad and updated monthly with a list of folder and file names, so each month i run it on varied systems it cleans up the junk for me..
(NEVER confuse a Back Slash with a Forward Slash)
And Also Remember Your Working In Windows NotePad

Its a simple task yet normally takes a fair old while by hand on multiple systems, so i designed a script that looks "Specifically" for files it knows about, this removes the risk of it removing anything it doesn't know.
IE it uses a known list rather than a wild card search based formula like *.log

When i run it, it looks like this...

My Cleaner Script With Basic Interface















When it's finished, it looks like this...

My Cleaner Script With Reboot Option When Finished















It Uses Standard Windows Command Prompt Code CMD to remove files and folders i have specified on the list, which saves me having to go in and out of  folders to get rid of stuff.

An example of some of the stuff it removes is the windows update mini folders, when you update windows it downloads the update and unpacks it to a temp dir in your Windows folder (its a hidden folder, so on default settings you cant see it)  some folders will be made directly in your windows folder like this

C:\WINDOWS\$NtUninstallQ828026$
100's of them after a fair while updating

You also get a folder in the windows folder that has 100's of folders in their to $hf_mig$
C:\WINDOWS\$hf_mig$\$NtUninstallKB896422$
100's of them

Then for each of the KB updates it places a log file in the windows dir
C:\WINDOWS\KB2141007.log
100's of them after a fair while updating

 Over time your system can be storing up to 2GB maybe 5GB, thats atleast 2 gigabyte of wasted drive space.  Please ber in mind when you download a windows update (just one) it downloads to here
C:\WINDOWS\SoftwareDistribution\Download

It then makes a back up of the files its going to replace, those replaced files get stored in the KB folder and the new files go in their original place.
So consider this,  you have the
files (In Use)
files (Backed Up)
files (Downloaded)

So every time you get a windows update you end up with 3 copies of the files on your system
   and you only need ONE...

One of the commands my script runs is this

RMDIR /Q /S %SystemRoot%\$hf_mig$

Windows CMD Code Break Down

RMDIR = Remove Directory (IE Delete That Folder)

 /Q   =  Removes all folders & files inside & the specified directory

  /S   = Answers the basic windows question of "are you sure you wish to send this to the bin"

%SystemRoot%  = The Windows Folder on your hard disk, normally C:\Windows, sometimes its D:\
 the SystemRoot parameter saves having to know the drive letter your windows is installed on

$hf_mig$ = The name of the folder we are removing (that specified directory)


So running that code  RMDIR /Q /S %SystemRoot%\$hf_mig$    removes 100's of files

Other folders that can be deleted are

C:\WINDOWS\ie7 (This is a BackUp of IE 6.0, in case you Uninstall 7)
C:\WINDOWS\ie8 (This is a BackUp of IE 7.0, in case you Uninstall 8)
Don't be fooled by thinking they are the Internet Explorer install folders

Their are also Update folders for each located here

C:\WINDOWS\ie7updates
C:\WINDOWS\ie8updates

Other apps depend on IE being up to date, so even if your offline, you still want to leave IE8 installed and remember that IE8 folder is just a back up of IE7, as is the IE7 folder a back up of IE6..
So to remove the useless folders you can use these 4 commands..

RMDIR /Q /S %SystemRoot%\ie7
RMDIR /Q /S %SystemRoot%\ie7updates
RMDIR /Q /S %SystemRoot%\ie8
RMDIR /Q /S %SystemRoot%\ie8updates

If you've ever installed a Windows Service Pack, that's about 480MB, once unpacked it resides here normally   C:\WINDOWS\ServicePackFiles

That can be removed using

RMDIR /Q /S %SystemRoot%\ServicePackFiles


Lets take a look at the Remove a Specific FILE command


DEL /Q /F %SystemRoot%\KB2633952.log


Windows CMD Code Break Down

DEL = Delete (IE Delete That Item)

 /Q   =   Quiet mode, do not ask if ok to delete the file

  /F   = Force deleting of read-only files "are you sure you wish to send system file"

%SystemRoot%  = The Windows Folder on your hard disk.

KB2633952.log = The name of the file we are removing

It is risky using a *.log based wild card because some systems have drivers & software that create a specific uninstall.log in the windows DIR, my script lists ONLY known logs & folders that are safe for deletion, rather than any file with the extension  .log

Never fear dos, its so stupid its simple
for example, click on Start, then Run, then type in CMD and click ok
to exit that box you type  EXIT and hit enter...

To bring up HELP for every dos based app you type its NAME and then a space and then   /?

Example

DEL /?    or   RMDIR /?

The app name, then a space, then a Forward Slash, then the question mark sign
and the App lists its help and available commands.














typing  CLS and hitting enter clears the screen


So go see how much drive space you have & make a note of it
then create a new text file   .txt  and paste this code below into it (ONLY the code)


RMDIR /Q /S %SystemRoot%\ie7
RMDIR /Q /S %SystemRoot%\ie7updates
RMDIR /Q /S %SystemRoot%\ie8
RMDIR /Q /S %SystemRoot%\ie8updates
RMDIR /Q /S %SystemRoot%\ServicePackFiles
RMDIR /Q /S %SystemRoot%\$hf_mig$
pause
exit

Make Sure this is ALL you have in the file and then save it

















save the file and close it, then right click on it and select RE NAME
rename it so its now  WindowsXPUpdateCleaner.BAT
















its icon should change, if it hasn't then its called  .bat.txt
it MUST end in .bat












 IF you have problems Renaming the file (god help u) lol anyway if you do
click on FILE and then SAVE AS and on the box at the Bottom, click the Drop Down
select ALL FILES and then Type the file name in with the  .BAT on the end like so



















Once its got the new icon, double click it (Unless You Have Updated & NOT Rebooted)
it will display messages and then pause
pressing any key will make it then exit..  now go see how much drive space you have free
Please ber in mind that's just a small demonstration using a couple of commands
this script can be run on ANY windows XP machine
and remember "file not found" isn't an issue, it just means it wasn't their to remove

To get back into your script "editing"  right click on your Bat file and select EDIT
and it'll open back up in notepad, remember now its a bat, not a txt, so its associated with CMD now, not notepad.. Don't try to associate cmd files by using the "Open With" and picking notepad and selecting always use notepad, because that'll stop bat files running  : /

I would be interested to no how much drive space you have recovered using the whole script, so please comment below with how much you managed to recover on your drive.
Never run this after updating ALWAYS reboot your system once or twice to make sure all the windows updates finished, and then run my script.

Shall we continue?

We also get folders off driver installers and microsoft .net, these tend to linger in random places and sometimes even on a number of your drives if you have more than 1 hard disk or 1 partition.
Some of them even have really whacked out folder names like these...


Config.Msi
69a3be9890d574aa909c
940fe6c6d0bcbb0076eaa902b0
2948183685d845a531e8
8daf30fb4cfa5fd50334284d759d
6ff1db70456e2b280bb01ad41f250887
d981a56b31de896aacea

We also have a command to empty the Windows Temp folder (not user, windows its self)
BUT we DON'T use the Force command on this one as some files in their maybe in use
So we use this command for that


DEL /Q %SystemRoot%\TEMP\*.*

Every user also has a Temp folder of their own, i tend to go in their and just hold CTRL & Press A (to select all) then delete everything i can from their.. that folder is located here


C:\Documents and Settings\YOUR LOG ON NAME\Local Settings\temp

you can also get to that folder easier by clicking Start then RUN and typing in  %TEMP%
and clicking OK, and it opens the folder on your windows account, bin what ever you can in their...

Also delete what ever you can IN Here
C:\WINDOWS\SoftwareDistribution\Download


So you run my script, then empty your user temp folder & Empty the Download folder in software distribution, defrag and see how much room you have.

My FULL script is available HERE as a TEXT File
(use the Green Button WITH the File Size) size will change as its updated















If your PC SAVI and you see OLD  KB folders OR Log files my script has missed Please list them in the comments below but ALSO REMEMBER... make Sure Their Old as in 2 or 3 months... on their properties...







1 comment:

  1. I just used the script on my pc and then on my g/f's laptop. recovered 2 and a half GB on mine and 3.75GB on hers, thanks bro

    ReplyDelete

Please keep comments clean...

Note: only a member of this blog may post a comment.