Jump to content

Misc WPI question and cleanup script


Recommended Posts

Im pretty new to this but my question is simple for most of you I think.

My problem is that i made my unattended setup using nlite, everything works fine.

I installed WPI and added ALL my programs, everything works fine testing with Virtual Machine.

The problem I cant seem to solve is HOW do I call a cleanup.cmd AFTER all the programs are installed?

Is it just that simple to add "%systemdrive%/wpi/cleanup.cmd" to my winnt.sif file under [GuiRunOnce], will it be executed last then or is there a way to call it in WPI and be sure it is called last? I havent found a solution for that...

I also havent found out how to implent cmdow.exe, reboot.vbs, resourses.exe and restoff.reg, the last two are files ive seen in an unattended version ive used to look at as an example to build my own. If anyone could explain to me I would be very happy and please don't flame me because I have searched the forum but I just cant seem to find the answer, maybe the explanations give isnt clear enought for me :}

Link to comment
Share on other sites

  • 1 month later...

The problem I cant seem to solve is HOW do I call a cleanup.cmd AFTER all the programs are installed?

I have the same problem

in winnt.sif file I have this:

GUIRunOnce]

command1 = "%systemdrive%\install\wpi\wpi.cmd"

command2 = "%SystemDrive%\D\BTS_DPs_finish.cmd"

command999 = "%SystemDrive%\install\start.cmd"

My cleanup script is in the start.cmd

And i that I have the following I have this:

CLS

@echo off

TITLE Welcome To The Predator

ECHO.

ECHO **************Finishing the installation****************

ECHO

ECHO ***********************Enjoy !**************************

ECHO.

ECHO Restarting the PC in 1 minute...

shutdown.exe -r -f -t 60 -c "Windows XP will now restart in 1 minute, this will give enough time for the shortcuts to update and for the shell to fully load before its ready to restart!"

ECHO.

ECHO Deleting Temp Installation Files...

RD /S /Q %systemdrive%\install

EXIT

What happens here is that the computer reboots b4 WPI has finished installing all the programs instructed...

Can anybody help???

Link to comment
Share on other sites

Increase your shutdown time....

Iknow, I know, your go "duh, i knew that", but really. Give it about 2 1/2 minutes before shutdown, that way if you use your disk on a "slower" machine or have a pesky program that needs just a little more time to finish, then it will work.

Hope this helps

Link to comment
Share on other sites

Correction, it worked but the last 4 programs would not install as the cleanup batch deletes all the installation files...

Is there a way to make the cleanup batch start l8er or include it in WPI???

Edited by Benzal
Link to comment
Share on other sites

@Benzal

If your computer is shutting down from the cleanup script before WPI finishes, that means there is a problem with WPI.cmd. WPI.cmd should have a line that goes "Start /wait WPI.hta," which prevents WINNT.sif from moving on to the next command until WPI.hta is finished installing all your programs. If the /wait was removed, then WINNT.sif would whip through the WPI.cmd file, starting the installation process, then finish installing the BTS driverpacks, and then run your cleanup. Basically you'd have multiple programs running at the same time, and the cleanup script would interfere with the WPI script. Check and make sure that you didn't accidently remove the /wait.

Increasing your shutdown time as Brandon suggested should have no effect, because that cleanup script shouldn't be running the same time as WPI anyway. It just needs to have a long enough wait to have time to delete the files in %ystemdrive%\install (which should not take very long, unless it is a LOT of files).

@Vecna

You can put your cleanup script in GuiRunOnce as the last command, but I prefer to have it in WPI.cmd. Just make sure it is after the "Start /wait WPI.hta" line, so that it runs after WPI installs your programs. I would also recommend running WPI.cmd last in GuiRunOnce, so that your cleanup script does not interfere with anything else you run through WINNT.sif.

Also, I'm not sure what reboot.vbs, resourses.exe and restoff.reg are, it would depend on where they are mentioned in the guide. Show us where they are mentioned in the guide and someone may be able to give more info.

Implementing CMDow.exe is easy enough though. Just call it at the beginning of a batch/cmd file with cmdow.exe @ /HID to hide the window, or use NirCMD (which is much better, in so many ways) when you call the batch file itself to prevent the window from opening at all.

Link to comment
Share on other sites

How about appending an AutoIt script to the end of GUIRunOnce to take care of the cleanup job after WPI is completed:

AutoItSetOption("TrayIconHide", 1)
AutoItSetOption("WinTitleMatchMode", 4)
BlockInput(1)

ProcessWaitClose("mashta.exe")

Run( @ScriptDir & "\cleanup.cmd", "", @SW_HIDE)

Compile the script and put it in the same directory as your cleanup batch. As an added benefit, you will not see any cmd window courtesy of the @SW_HIDE feature. I haven't tested it, but it should work.

Link to comment
Share on other sites

I do have Start /wait WPI.hta....

This is a copy of my wpi.cmd:

CLS

@ECHO OFF

Echo Changing the windows resolution

Echo please wait...

start /wait 1365VidChng.exe 1024x768x32@85 -q

REM Example, how to look for CDROM-drive. Must have a file to identify in its root (like WIN51 or WPI.ico).

for %%i 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 %%i:\wpi.ico set CDROM=%%i:

echo Found CD-Rom as drive %CDROM%

REM Determine the WPI startup path.

REM if wpi should run off the cd the replace %~dp0 with %cdrom%.

set wpipath=%~dp0

REM Force resolution to needed size for wpi interface.

--start %wpipath%\common\VideoChanger.exe 1280x1024x32@85 -q

REM Hide this command window.

"%wpipath%\common\cmdow.exe" @ /hid

REM Font installation - the smooth and customizable way.

start /wait %wpipath%\common\fonts\fontinstaller.exe

REM Special registry tweak needed.

regedit /s "%wpipath%\common\wpi.reg"

REM Make WPI directory the current directory.

for /f "delims=: tokens=1" %%i in ("%wpipath%") do %%i:

cd "%wpipath%"

REM Start WPI and wait for its end

start /wait WPI.hta

REM Cleaning up the desktop.

del /s/q "%userprofile%\desktop\*.lnk"

REM Rebooting the sytem to finalize the installation process.

--shutdown.exe -r -f -t 10 -c "Reboot in 10 sec..."

exit

:end

According to this there is already a reboot sequence but it doesn't seem to work...

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