Jump to content

Recommended Posts

Posted

How do I defrag systemdrive silently at cleanup.cmd?

I am using WPI, called (WPI.cmd) from RunOnceEx part of winnt.sif. At the end of WPI i call cleanup.cmd that deletes shortcuts and tempfiles. WPI.cmd reboots at the very end. So the best would be to have a defragment at the end of cleanup.cmd.


Posted (edited)

for deleting temp files, this may be of use to you :)

del "%systemdrive%\Documents and Settings\Administrator\Local Settings\Temp" /q
rd "%systemdrive%\Documents and Settings\Administrator\Local Settings\Temp" /s /q
del "%systemdrive%\Documents and Settings\Administrator\Local Settings\Temporary Internet Files" /q
rd "%systemdrive%\Documents and Settings\Administrator\Local Settings\Temporary Internet Files" /s /q
del "%userprofile%\Local Settings\Temp" /q
rd "%userprofile%\Local Settings\Temp" /s /q
mkdir "%userprofile%\Local Settings\Temp"
del C:\Recycled\?*.* /q
rd C:\Recycled /s/q
del C:\Recycler\?*.* /q
rd C:\Recycler /s/q
del "%userprofile%\Local Settings\Temporary Internet Files" /q
rd "%userprofile%\Local Settings\Temporary Internet Files" /s /q

Edited by Alanoll
Posted

I don't know for sure but I believe that MS Defrag has commandline support.

So with the appropriate switches you could call it at the end of your batchfile.

Posted

If you use Diskeeper for defraggin (which you should be if youre not), theres this thread that walks you through it...

It seemed a bit involved when I first took a peak at it so I never bothered in getting around to trying it, but give it a shot if youre determined to do so!

Let us know how it works out!

Posted

defrag.exe %systemdrive% -f

In dutch:

defrag.exe <volume> [-a] [-f] [-v] [-?]
 volume  Stationsletter of koppelpunt (d: of d:\vol\koppelpunt)
 -a      Alleen analyseren
 -f      Forceert defragmentatie, ook als de beschikbare ruimte klein is
 -v      Uitgebreide weergave
 -?      Deze hulptekst weergeven.

In English (there could be some translation errors) :

defrag.exe <volume> [-a] [-f] [-v] [-?]
-a        only analyse
-f        force defregmantation, also if available space is low
-v       show advanged view
-?        show help

It works :thumbup

@bledd:

Yes, just what I was looking for!!

Thanks :thumbup

Posted

if anyone knows anywhere else I should add to that list, please tell me..

the recycled is for win2k, recycler is winxp

I've created that to run at login in our login script at work

Posted
if anyone knows anywhere else I should add to that list, please tell me..

the recycled is for win2k, recycler is winxp

I've created that to run at login in our login script at work

Here is what I use. You should create another thread for this topic I bet alot of people have stuff we haven;t listed here and may not see this conversation since the topic is related to Defrag :P

ECHO Removing useless shortcuts...
DEL "%systemdrive%\Documents and Settings\All Users\Start Menu\Windows Update.lnk"
DEL "%systemdrive%\Documents and Settings\All Users\Start Menu\Set Program Access and Defaults.lnk"
DEL "%systemdrive%\Documents and Settings\All Users\Start Menu\Windows Catalog.lnk"
DEL "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\MSN.lnk"
DEL "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\Windows Messenger.lnk"
DEL "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\Windows Movie Maker.lnk"
RD /S /Q  "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\Games"
RD /S /Q  "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\Accessories"
RD /S /Q  "%USERPROFILE%\Start Menu\Programs\Accessories"
DEL "%USERPROFILE%\Start Menu\Programs\Internet Explorer.lnk"
DEL "%USERPROFILE%\Start Menu\Programs\Outlook Express.lnk"
DEL "%USERPROFILE%\Start Menu\Programs\Remote Assistance.lnk"
DEL "%USERPROFILE%\Start Menu\Programs\Windows Media Player.lnk"

Posted

ECHO Removing useless shortcuts...

RD /S /Q "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\Accessories"

Sure... I suppose I don't need to get to Defrag.... or Wordpad... or Calculator....

Kinda harsh don't ya think?

'33'

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...