23rd October 2007
Just after some more help on batch scripts. My previous thread was copying files from the CD Rom to the Hard Drive.
Now because of certain issues...WPI, vLite, and a few other questions - MSFN Forums
That is no longer possible, so I have a way to copy the contents to the hard drive, then from hard drive to hard drive.
I am intergrating programs using WPI into a Vlited DVD, so I will move the WPI folder on the DVD to the sources\scripts folder, which is automatically copied over to the hard drive during Vista installation. Then the setupcomplete.cmd file is automatically launched after any Vista install. This is where I am moddifying the script to do what I want...
Is someone please able to run through my script and tell me if they think it will work. My Vista ISOs are 4GB each, And I have two of them. Two DVDs to install my Version of Vista im making up, So as you can imagine is very time consuming to create the ISOs, Format and install in a new VM, just to find it fails.
@echo off TITLE Finalizing Setup Stage ECHO !! !! ECHO !! !! ECHO !! DO NOT CLOSE THIS WINDOW !! ECHO !! !! ECHO !! !! ECHO. ECHO Installing Boot Manager Grub, Please wait... ECHO. for %%A 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 %%A\bootmgr ( if not exist %%A\setup.exe ( echo. echo Installing to drive %%A echo. if exist %%A\menu.lst attrib %%A\menu.lst -h -r -s if exist %%A\menu.lst ren %%A\menu.lst menu_lst.bak if exist %%A\grldr attrib %%A\grldr -h -r -s copy %systemroot%\setup\scripts\grldr %%A\grldr attrib %%A\grldr +h +s +r %systemroot%\setup\scripts\bootinst /nt60 %%A ) ) )
ECHO Installing Windows Post Installer, please wait... ECHO. ECHO STEP 1: PREPARING TO COPY FILES ECHO. ECHO Preparing to copy files... ECHO Please wait...
:makedir ECHO. ECHO STEP 2: CREATING DIRECTORY STRUCTURE ECHO. ECHO Directory Structure Being Created... md %SYSTEMDRIVE%\WPI_Applications IF ERRORLEVEL 1 GOTO retry ECHO Done! ECHO. ECHO STEP 3: COPYING DIRECTORYS AND FILES ECHO. xcopy %CD%\WPI %SYSTEMDRIVE%\WPI_Applications /e /f /y /c /v IF ERRORLEVEL 1 GOTO error
ECHO. ECHO Verifying... ECHO. cd %SYSTEMDRIVE%\WPI_Applications dir /s /b ECHO. ECHO File Transfer Complete... ECHO. ECHO Performing cleanup steps... ECHO Removing temp files... cd %windir%\setup\sources\scripts del WPI /F /Q rd WPI ECHO Now executing Windows Post Installer, then Exiting script... Start %systemdrive%\WPI_Applications\WPI.hta ECHO Goodbye! pause exit /B
:error ECHO. ECHO File Transfer Failed! ECHO You will not be able to run WPI Applications from your HDD later ECHO You will instead require this install DVD ECHO Now exiting... ECHO Goodbye! pause exit /B
:retry ECHO. ECHO ERROR STEP 1: REMOVING PRIOR DIRECTORY STRUCTURE ECHO. ECHO Removing directory and contents... rd %SYSTEMDRIVE%\WPI_Applications /s /q IF NOT ERRORLEVEL 1 GOTO exit ECHO Done! ECHO Retrying Directory Structure Creation... GOTO makedir
:exit ECHO An error occured that this script could not correct ECHO You will not be able to run WPI Applications from your HDD later ECHO You will instead require this install DVD ECHO Or instead you can try a manual copy ECHO Now exiting... ECHO Goodbye! pause exit /B That is the current contents of the setupcomplete.cmd file
Does it look like it will work.
From what I've been able to replicate and setup on my laptop, it seems to, I just want to be sure before I go and spend another 4 hours installing Vista into a new VM for it to fail
Huh yeah, whatever ^^
6th December 2006
To me, looks like it will not. I'm not 100% sure about it, but I believe the only time where you need a double "%" to quality a variable is the FOR command. In any other place you should use only one % with that variable name.
I only gave a fast look on the script, cause I don't like much the "exit" commands everywhere, I'd prefer a single exit point where you get from every place you need to with a goto, after having done everything you need to.
Well, that and I don't know anything about that bootinst command ; maybe I'll have a closer look at it later...
23rd October 2007
the %% variables where already in the batch script and appear to work ok.
I'll see what i cna do about multiple exit commands