Jump to content

Cleanup using batch scripting during UA install


Recommended Posts

I was curious if there's a way to delete folders on the hard disk following the installation AFTER rebooting the system. Some of my apps require a restart otherwise I get an error when i try to delete the C:\install folder after the first Windows logon. Here's my batch file...

CLS

@echo off

TITLE Windows XP SP2 - Gary's Unattended Installation

ECHO.

ECHO Over the next few minutes you will see automated installations

ECHO of various sofware applications, windows updates, and registry

ECHO adjustments. Enjoy the ride!

ECHO From Gary...with love

ECHO

ECHO Installing Nero Burning ROM 6.6.018

ECHO Please wait...

start /wait %systemdrive%\install\Applications\Nero\Nero66018.exe /silent /noreboot /no_ui /sn=itnvv2e28qav0rphm7uwpjrjpk0 /write_sn

ECHO

ECHO Installing Kerio Personal Firewall 4.2.2

ECHO Please wait...

start /wait %systemdrive%\install\Applications\Kerio\KPF422.exe /s /v" /qn REBOOT=Suppress"

ECHO

ECHO Installing Outlook Express Backup 6.5

ECHO Please wait...

start /wait %systemdrive%\install\Applications\Outlook\OEB.exe /VERYSILENT /SP-

ECHO

ECHO Installing PhotoStory 3

ECHO Please wait...

start /wait %systemdrive%\install\Applications\PhotoStory3\PhotoStory3.exe

ECHO

ECHO Installing QuickTime Alternative Alternative 1.68

ECHO Please wait...

start /wait %systemdrive%\install\Applications\QuickTime\QTALT168.exe /VERYSILENT /SP-

ECHO

ECHO Installing Real Alternative 1.46

ECHO Please wait...

start /wait %systemdrive%\install\Applications\Real\REALALT146.exe /VERYSILENT /SP-

ECHO

ECHO Installing Kazaa Lite K++ 2.43

ECHO Please wait...

start /wait %systemdrive%\install\Applications\KazaaLite\klite243.exe /silent

ECHO

ECHO Installing Tune Up Utilities 2006

ECHO Please wait...

start /wait %systemdrive%\install\Applications\TuneUp\TU2006.exe /q

ECHO

ECHO Installing AnyDVD 5.8.2.1

ECHO Please wait...

start /wait %systemdrive%\install\Applications\AnyDVD\AnyDVD.exe /S /NOREBOOT

ECHO

ECHO Installing AutoIT

ECHO Please wait...

start /wait %systemdrive%\install\Applications\AutoIT\AutoIT.exe /S

ECHO

ECHO Installing VirtualDub

ECHO Please wait...

start /wait %systemdrive%\install\Applications\VirtualDub\VirtualDub.msi /qn

ECHO

ECHO Installing nLite 1.0 RC5

ECHO Please wait...

start /wait %systemdrive%\install\Applications\nLite\nLite.exe /VERYSILENT /SP-

cls

@echo off

ECHO.

ECHO Installing Webshots Desktop 2.0

start /wait %systemdrive%\install\Applications\Webshots\webshots.js

del "%UserProfile%\Desktop\Webshots Desktop.lnk"

REGEDIT /S %systemdrive%\install\Applications\Webshots\webshots.reg

ECHO.

ECHO

ECHO Installing Office 2003 Professional

ECHO Please wait...

start /wait %systemdrive%\install\Applications\Office2003\setup.exe TRANSFORMS=Unattended.MST /qb-

ECHO

ECHO Installing FrontPage 2003

ECHO Please wait...

start /wait %systemdrive%\install\Applications\FrontPage2003\setup.exe TRANSFORMS=Unattended.MST /qb-

ECHO.

ECHO Performing System Cleanup

DEL "%systemdrive%\install"

DEL "%systemdrive%\msasw"

DEL "%systemdrive%\Drivers"

RD /S /Q "%AllUsersProfile%\My Documents\My Music\Sample Playlists"

RD /S /Q "%AllUsersProfile%\My Documents\My Pictures\Sample Pictures"

ECHO Done!

EXIT

Any assistance would be greatly be appreciated.

Link to comment
Share on other sites


To delete a folder after restart, run a batch, called e.g. Runonceex.cmd containing:

@echo off
setlocal enableextensions

SET KEY=HKLM\SOFTWARE\Microsoft\Windows\CurrentVersion\RunOnceEx
REG ADD %KEY% /V TITLE /D "Running last tasks" /f

REG ADD %KEY%\010 /VE /D "Deleting the install-directory" /f
REG ADD %KEY%\010 /V 1 /D "%COMSPEC% /C rmdir %SYSTEMDRIVE%\Install /s /Q" /f
endlocal

After a restart, this deletes the folder %SYSTEMDRIVE%\Install after the login.

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