Jump to content

Clean-Up.cmd woes


Recommended Posts

Hi, hope some one can help/

I am trying to script my clean-up.cmd to organize my start menu but can only get a couple of things to work. If someone could scan over my script and give me some pointers, or, if some one has already done this, post their script so i can have a look and try to figure out what to do, i would be most appreciative.

CLS
@echo off
TITLE Windows XP SP2 - Clean-Up

IF EXIST D:\CD.txt set CDROM=D:
IF EXIST E:\CD.txt set CDROM=E:
IF EXIST F:\CD.txt set CDROM=F:
IF EXIST G:\CD.txt set CDROM=G:
IF EXIST H:\CD.txt set CDROM=H:
IF EXIST I:\CD.txt set CDROM=I:
IF EXIST J:\CD.txt set CDROM=J:

SET PR=C:\Documents and Settings\Administrator\Start Menu\Programs\ <--------Have tried setting this to %USERPROFILE%\Start Menu\Programs\
SET DC=%USERPROFILE%\My Documents\
SET SC=%CDROM%\EXTRAS\
SET AP=C:\Documents and Settings\All Users\Start Menu\Programs\ <------Have tried setting this to %ALLUSERPROFILE%\Start Menu\Programs\

ECHO.
ECHO Restarting the PC in 2 minutes...
shutdown.exe -r -f -t 120 -c "Windows XP will now restart in 2 Minutes!!"

ECHO.
ECHO Deleting Temp Installation Files...
RD /S /Q "%systemdrive%\DAEMON\"

ECHO.
ECHO Deleting Desktop Shortcuts...
DEL /F /Q "%USERPROFILE%\DESKTOP\*.lnk"
DEL /F /Q "%ALLUSERPROFILE%\DESKTOP\*.lnk"

ECHO.
ECHO Organising Start Menu...
XCOPY /E /Y /I /Q "%PR%\3 SECURITY\Ad-Aware SE Personal.lnk" "%PR%\UTILS\"
XCOPY /E /Y /I /Q "%PR%\3 SECURITY\Spybot - Search & Destroy.lnk" "%PR%\UTILS\"
DEL /F /Q "%PR%\3 SECURITY\Ad-Aware SE Personal.lnk"
DEL /F /Q "%PR%\3 SECURITY\Spybot - Search & Destroy.lnk"
RD "%PR%\3 SECURITY\"
------------------------------------------------------------Everything Up To Here Works---------------------------------------------------------------
XCOPY /E /Y /I /Q "%AP%\NLITE\NLITE.lnk" "%AP%\UTILS\"
DEL /F /Q "%AP%\NLITE\*.*"
RD "%AP%\NLITE\"
DEL /F /Q "%PR%\Lavasoft Ad-Aware SE Personal\*.*"
RD "%PR%\Lavasoft Ad-Aware SE Personal\"
XCOPY /E /Y /I /Q "%PR% DISK\*.*" "%PR%"
RD "%PR% DISK\"
RD "%AP%\ESET\"
RD "%AP%\VIDEOLAN\"
RD "%AP%\ULTRAEDIT\"
RD "%PR%\UNLOCKER\"
RD "%PR%\2 OFFICE\"
RD "%PR%\8 VIDEO\"
XCOPY /E /Y /I /Q "%PR%\MAGICISO\MAGICISO.LNK" "%PR%\UTILS\"
DEL /F /Q "%PR%\MAGICISO\*.*"
RD "%PR%\MAGICISO\"
MKDIR "%AP%\Apps\"
XCOPY /E /Y /I /Q "%AP%\CUCUSOFT VIDEO CONVERTER\Cucusoft AVI to VCD DVD MPEG Creator Pro.LNK" "%AP%\Apps\"
DEL /F /Q "%AP%\CUCUSOFT VIDEO CONVERTER\*.*"
RD "%AP%\CUCUSOFT VIDEO CONVERTER\"
DEL /F /Q "%AP%\GAMES\*.*"
RD "%AP%\GAMES\"
XCOPY /E /Y /I /Q "%AP%\NEODOWNLOADER\NEODOWNLOADER.LNK" "%PR%\UTILS\"
DEL /F /Q "%AP%\NEODOWNLOADER\*.*"
RD "%AP%\NEODOWNLOADER\"
XCOPY /E /Y /I /Q "%AP%\OBJECT DESKTOP\WINDOWBLINDS.LNK" "%AP%\APPS\"
DEL /F /Q "%AP%\OBJECT DESKTOP\*.*"
RD "%AP%\OBJECT DESKTOP\"
XCOPY /E /Y /I /Q "%AP%\SMART PROJECTS\ISOBUSTER\ISOBUSTER.LNK" "%PR%\UTILS\"
DEL /F /Q "%AP%\SMART PROJECTS\*.*"
RD "%AP%\SMART PROJECTS\"
XCOPY /E /Y /I /Q "%AP%\Sony\Sound Forge 8.0\Sound Forge 8.0.LNK" "%AP\APPS\"
DEL /F /Q "%AP%\SONY\*.*"
RD "%AP%\Sony\"
XCOPY /E /Y /I /Q "%PR%\4 SYSTEM\Everest 3.00.626.LNK" "%PR%\UTILS\"
DEL /F /Q "%PR%\4 SYSTEM\*.*"
RD "%PR%\4 SYSTEM\"
DEL /F /Q "%AP%\WINDOWS MESSENGER.LNK"
DEL /F /Q "%AP%\WINDOWS MOVIE MAKER.LNK"
DEL /F /Q "%AP%\MSN.LNK"
DEL /F /Q "%AP%\ADOBE HELP CENTER.LNK"
DEL /F /Q "%PR%\OUTLOOK EXPRESS.LNK"
DEL /F /Q "%PR%\REMOTE ASSISTANCE.LNK"
DEL /F /Q "%USERPROFILE%\START MENU\*.LNK"
XCOPY /E /Y /I /Q "%SC%\SHORTCUTS\UTORRENT.LNK" "%USERPROFILE%\START MENU\"
XCOPY /E /Y /I /Q "%SC%\SHORTCUTS\RESHACKER.LNK" "%PR%\UTILS\"
XCOPY /E /Y /I /Q "%SC%\SHORTCUTS\TRESIZE.LNK" "%PR%\UTILS\"
XCOPY /E /Y /I /Q "%SC%\SHORTCUTS\FOLDERSIZE.LNK" "%PR%\UTILS\"
------------------------------------------------Everything From Here On Works--------------------------------------------------------------

ECHO.
ECHO Installing Wallpapers...
MKDIR "%DC%\Wallpapers\"
XCOPY /E /Y /I /Q "%SC%\WALLPAPERS\*.JPG" "%DC%\WALLPAPERS\"
XCOPY /E /Y /I /Q "%SC%\WALLPAPERS\*.BMP" "%DC%\WALLPAPERS\"
XCOPY /E /Y /I /Q "%SC%\WALLPAPERS\*.PNG" "%DC%\WALLPAPERS\"

ECHO.
ECHO Installing Favourites...
XCOPY /E /Y /I /Q "%SC%\FAVOURITES\*.*" "%USERPROFILE%\FAVORITES\"
DEL /F /Q "%USERPROFILE%\FAVORITES\LINKS\*.*"
DEL /F /Q "%USERPROFILE%\FAVORITES\MICROSOFT WEBSITES\*.*"
RD "%USERPROFILE%\FAVORITES\LINKS"
RD "%USERPROFILE%\FAVORITES\MICROSOFT WEBSITES\"

EXIT

Sometimes, cant remember whether its when i have set things to SET PR=%USERPROFILE%, or SET PR=C:\Documents and blah blah blah, it creates folders in the root of c: called, Start, Menu and Programs.

Please could someone help, this is driving me crazy.

Many Thanks Iain

Edited by iainstott
Link to comment
Share on other sites


Something strikes me as a little odd here!

Why install to

  • 2 OFFICE
  • 3 SECURITY
  • 4 SYSTEM
  • 8 VIDEO

and then move from and delete those program groups

Just change whatever you used to install the shortcuts there in the first place to the locations you now require.

Link to comment
Share on other sites

also for now...

Because the variables are set with trailing backslashes all the paths using them look like this \\ instead of this \. There are several pointless trailing backslashes added to many of the locations too. A trailing backslash in a batch file can be used as an escape character if preceding a double quote!

Why take a slice of bread from a loaf and throw it away, then throw out the whole loaf, when you can just throw the loaf? (Why xcopy - delete - remove)

Why xcopy - delete anyway, when a move will do!

Why the /E switch and in many cases the /I switch in the xcopy commands?

I find it strange that there is a folder called "<space>DISK"

Link to comment
Share on other sites

Thanks for your replies, have only just started looking into this area, and xcopy and delete was the only way i could find/understand to move things.

The folders 2 OFFICE, 3 SECURITY, 4 SYSTEM & 8 VIDEO were created by silent instellers created by my friend, which i have pinched off his unattended install, and i cant figure out how to change the path the shortcuts are installed to.

Many thanks Iain

Edited by iainstott
Link to comment
Share on other sites

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