Thanks, Asta. While we're on the subject, here's my method:
Grab a copy of
AutoRun.exe from
Tarma Software Research and place it at the root of the CD. The user manual is brief and well-written, explaining in detail how to use the handful of switches employed by this nifty little utility. Then create an AUTORUN.INF file. Mine looks like this:
[autorun]
open=autorun.exe -q2 -x wpi\WPI.hta cleanup.exe finish.exe
icon=wpi.ico
As you can see, autorun.exe first runs the WPI app and then let's me run a "cleanup" operation and a "finish" operation. My cleanup is an AutoIt script that calls (and hides) a batch file:
Cleanup.au3
AutoItSetOption("TrayIconHide", 1)
AutoItSetOption("WinTitleMatchMode", 4)
BlockInput(1)
Run( @ScriptDir & "\cleanup.cmd", "", @SW_HIDE)
cleanup.cmd
@echo off
IF NOT EXIST "%programfiles%\Rocket\RKlauncher.exe" GOTO Continue
::Locate the CDROM drive if necessary, where AUTORUN.INF exists at the root...
FOR %%d IN (c: d: e: f: g: h: i: j: k: l: m: n: o: p: q: r: s: t: u: v: w: x: y: z:) DO IF EXIST %%d\AUTORUN.INF SET CDROM=%%d
Call %cdrom%\programs\cleanup\desktop.cmd
:Continue
RD /S /Q "%systemdrive%\Drivers"
ECHO Y | Del "%systemdrive%\WINDOWS\*.bmp"
ECHO Y | Del "%systemdrive%\*.log"
DEL /F "%systemdrive%\Documents and Settings\All Users\Start Menu\Programs\Startup\Finis***.exe"
@Rmdir %systemdrive%\TEMP /s/q
@mkdir %systemdrive%\TEMP
@Rmdir %systemdrive%\WINDOWS\TEMP /s/q
@mkdir %systemdrive%\WINDOWS\TEMP
CLS
EXIT
I allow users to select a program written by
RaduKing during the WPI install. If they choose it, then desktop icons are removed. If not, then not.
My finish.exe is an AutoIt script that simply waits for WPI and the cleanup operation to finish before launching a restart script that ejects the CD and prompts the user to choose whether to restart the machine:
Finish.au3
AutoItSetOption("TrayIconHide", 1)
AutoItSetOption("WinTitleMatchMode", 4)
BlockInput(0)
ProcessWaitClose("mshta.exe")
RunWait("cleanup.exe")
Run("restart.exe")
Restart.au3
AutoItSetOption("TrayIconHide", 1)
AutoItSetOption("WinTitleMatchMode", 4)
BlockInput(0)
SplashTextOn("", "" & @CRLF & "Installation completed successfully!" & @CRLF & "", 275, 58, -1, -1, 1, "Arial", 12, 12)
Sleep(2000)
SplashOff()
Sleep(1000)
$driveArray = StringSplit("DEFGHIJKLMNOPQRSTUVWXYZ", "")
For $i = 1 To 23
$opened = CDTray($driveArray[$i] & ":", "open")
If $opened Then ExitLoop
Next
If NOT $opened Then
Shutdown(6)
EndIf
Sleep(3000)
;Restart option
$Yes = 6
$No = 7
$Answer = MsgBox(4, "User Option", "Do you want to restart the Machine?")
If $Answer = $Yes Then
Sleep(3000)
Shutdown(6)
Exit
ElseIf $Answer = $No Then
Exit
EndIf
Compile the AutoIt scripts and place all files at the root of the CD with Autorun.exe. Takes a little time to set it all up, but it works great for me!