Monday 24 June 2013

Extra Hard Disk Drive Space On Windows XP

OLD THREAD, UPDATED THREAD TO FOLLOW IS NOW  HERE

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

This is a script of sorts written in windows notepad and (was)  updated monthly when XP was in full swing 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 which you don't need. This removes ALL risk of it removing anything it doesn't know. As such, I won't shorten the script with the use of a  *.log  aspect, To avoid it killing 3rd party uninstall log files.

IE, It uses a known list rather than a wild card search based formula like *.log

When you run it, it pretty much 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$
You get 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 at-least 2.8 gigabyte of wasted drive space on most systems. 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
Downloaded files (Installed In Use)
Original files (Backed Up)
Update files (Downloaded still lingering)

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...

Note, for offline installing of windows updates you can pre-empt the creation of these folders and logs by simply adding the /nobackup command switch to your update install script.

One of the commands my script runs is this

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

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:\

That   %SystemRoot%   parameter saves having to know the drive letter your windows is installed on and saves having the script set a path.

$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 folders and files

Other folders that can be deleted are

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

There are also Update folders for each Internet Explorer located here

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

That can be binned using

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


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


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, that folder is located here

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

You can 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...

To empty the current user temp, i use this

ECHO Removing All files and folders from Current User Temp folder
DEL /Q %TEMP%\*.*
DEL /S /F /Q %TEMP%\*.*
@echo off
del %TEMP%\. /f /q
for /f "tokens=*" %%i in ('dir %TEMP%\. /b') do rd "%TEMP%\%%i" /s /q

It sweeps in a number of ways, if you receive an error during this then a file maybe still in use OR it could actually be malware that's active, most things you can delete from you rown temp folder under normal circumstances, though things like

Also delete what ever you can see IN Here (after windows is fully updated)
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 and more is added
IF THE LINK FAILS REVIEW THE NEW THREAD THAT IS UPDATED IN REAL TIME














If your PC SAVI and you see OLD  KB folders OR Log files my script has missed Please list them in the comments ON THIS POST HERE






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... and on topic